1. override
Future<Response> handle(Request request)

Source

@override Future<Response> handle(Request request) async {
  if (!methods.contains(request.method)) {
    return await super.handle(request);
  }
  final url = request.url.path.split('/').where((s) => s.isNotEmpty).join('/');
  final wildcards = _expander.parseWildcards(path, url);
  if (regexPath.hasMatch(url)) {
    try {
      for (final wc in wildcards.keys) {
        context.container = context.container
          .bindName(wc, to: wildcards[wc]);
        if (new RegExp(r'^\d+$').hasMatch(wildcards[wc])) {
          context.container = context.container
            .bindName(wc, to: int.parse(wildcards[wc]));
        }
        if (new RegExp(r'^\d*\.\d+$').hasMatch(wildcards[wc])) {
          context.container = context.container
            .bindName(wc, to: double.parse(wildcards[wc]));
        }
      }
      return await pipeline()(request.change(
          path: _expander.prefix(path, url)
      ));
    } on NoResponseFromPipelineException {
      return await super.handle(request);
    }
  }

  return await super.handle(request);
}