httpRouteHandler function
Implementation
RouteData? httpRouteHandler(HttpRequest req) {
RouteData? route = _getMatchRoute(
req.uri.path,
req.method,
req.headers.value(HttpHeaders.hostHeader),
);
if (route == null) {
/// return 200 status on preflight OPTIONS Method
if (req.method == HttpRequestMethod.OPTIONS.name) {
responseDataHandler(null, req);
} else {
req.response.statusCode = HttpStatus.notFound;
responseDataHandler('${req.method} ${req.uri.path} not found', req);
}
}
return route;
}