Browse Source

Removes line as use case is covered by #422

pull/517/head
RaviKiran Kilingar 5 years ago
parent
commit
16bead4007
No known key found for this signature in database
GPG Key ID: 47D29311AEB6F0A7
  1. 9
      route.go

9
route.go

@ -74,13 +74,14 @@ func (r *Route) Match(req *http.Request, match *RouteMatch) bool {
return false return false
} }
// If a route matches, but the HTTP method does not, we do one of two (2) things:
// 1. Reset the match error if we find a matching method later.
// 2. Else, we override the matched handler in the event we have a possible fallback handler for that route.
//
// This prevents propagation of ErrMethodMismatch once a suitable match is found for a Method-Path combination
if match.MatchErr == ErrMethodMismatch { if match.MatchErr == ErrMethodMismatch {
// We found a route which matches request method, clear MatchErr // We found a route which matches request method, clear MatchErr
match.MatchErr = nil match.MatchErr = nil
// Then override the mis-matched handler
if r.handler != nil {
match.Handler = r.handler
}
} }
// Yay, we have a match. Let's collect some info about it. // Yay, we have a match. Let's collect some info about it.

Loading…
Cancel
Save