init static method

Future<Request> init(
  1. HttpRequest request,
  2. EndPoint endPoint
)

Implementation

static Future<Request> init(io.HttpRequest request, EndPoint endPoint) async {
  ///* set up request path params
  final _pathParams = <String>[];
  final _pathRegx = pathToRegExp(endPoint.path, parameters: _pathParams);
  final match = _pathRegx.matchAsPrefix(request.uri.path);

  var _routeParams = <String, String>{};
  if (match != null) _routeParams = extract(_pathParams, match);

  return Request._(
    request: request,
    params: _routeParams,

    ///* set up request query params
    queryParams: request.uri.queryParameters,
  );
}