match static method
Iterable<HttpRouteMatch>
match(
- String input,
- List<
HttpRoute> options, - ServerUniverseMethodType method
ServerUniverseUncompleteDocumentation
Implementation
static Iterable<HttpRouteMatch> match(String input, List<HttpRoute> options,
ServerUniverseMethodType method) sync* {
// decode URL path before matching except for "/"
final inputPath =
Uri.parse(input).path.normalizePath.decodeUri(DecodeMode.AllButSlash);
for (final option in options) {
// Check if http method matches
if (option.method != method &&
option.method != ServerUniverseMethodType.all) {
continue;
}
// Match against route RegExp and capture params if valid
final match = option.matcher.firstMatch(inputPath);
if (match != null) {
final routeMatch = HttpRouteMatch.tryParse(option, match);
if (routeMatch != null) {
yield routeMatch;
}
}
}
}