Skip to content

Commit

Permalink
Readability Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaManiac committed Nov 13, 2018
1 parent a3c6549 commit a61617d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ impl<Data> Router<Data> {
path: &'a str,
method: &http::Method,
) -> Option<(&'a BoxedEndpoint<Data>, 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))
}
}
}
Expand Down

0 comments on commit a61617d

Please sign in to comment.