diff --git a/src/router.rs b/src/router.rs index 98afb2dbc..b02119db9 100644 --- a/src/router.rs +++ b/src/router.rs @@ -25,13 +25,13 @@ impl Router { path: &'a str, method: &http::Method, ) -> Option<(&'a BoxedEndpoint, RouteMatch<'a>)> { - let route = self.table.route(path)?; + let (route,route_match) = self.table.route(path)?; // If it is a HTTP HEAD request then check if there is a callback in the endpoints map // if not then fallback to the behavior of HTTP GET else proceed as usual - if method == http::Method::HEAD && !route.0.endpoints.contains_key(&http::Method::HEAD) { - Some((route.0.endpoints.get(&http::Method::GET)?, route.1)) + if method == http::Method::HEAD && !route.endpoints.contains_key(&http::Method::HEAD) { + Some((route.endpoints.get(&http::Method::GET)?, route_match)) } else { - Some((route.0.endpoints.get(method)?, route.1)) + Some((route.endpoints.get(method)?, route_match)) } } }