Fix #271: Return 405 instead of 404 when request method doesn't match the route

This commit is contained in:
Mayank Patel
2017-08-30 11:09:17 +05:30
committed by Kamil Kisiel
parent ac112f7d75
commit a659b61323
4 changed files with 89 additions and 7 deletions

View File

@@ -121,12 +121,7 @@ func TestRouteMatchers(t *testing.T) {
var routeMatch RouteMatch
matched := router.Match(request, &routeMatch)
if matched != shouldMatch {
// Need better messages. :)
if matched {
t.Errorf("Should match.")
} else {
t.Errorf("Should not match.")
}
t.Errorf("Expected: %v\nGot: %v\nRequest: %v %v", shouldMatch, matched, request.Method, url)
}
if matched {
@@ -188,7 +183,6 @@ func TestRouteMatchers(t *testing.T) {
match(true)
// 2nd route --------------------------------------------------------------
// Everything match.
reset2()
match(true)