Revert "Merge pull request #51" Fixes #52
diff --git a/router.go b/router.go index 3a562bd..7716dc7 100644 --- a/router.go +++ b/router.go
@@ -313,21 +313,6 @@ } } - // Handle 405 - for method := range r.trees { - if method == req.Method { - continue - } - - if handle, _, _ := r.trees[method].getValue(req.URL.Path); handle != nil { - http.Error(w, - http.StatusText(http.StatusMethodNotAllowed), - http.StatusMethodNotAllowed, - ) - return - } - } - // Handle 404 if r.NotFound != nil { r.NotFound(w, req)
diff --git a/router_test.go b/router_test.go index 9703908..7c8ac09 100644 --- a/router_test.go +++ b/router_test.go
@@ -165,23 +165,6 @@ } } -func TestRouterNotAllowed(t *testing.T) { - handlerFunc := func(_ http.ResponseWriter, _ *http.Request, _ Params) {} - method := "/method" - code := 405 - - router := New() - router.POST(method, handlerFunc) - - // Test not allowed - r, _ := http.NewRequest("GET", method, nil) - w := httptest.NewRecorder() - router.ServeHTTP(w, r) - if !(w.Code == code) { - t.Errorf("NotAllowed handling route %s failed: Code=%d, Header=%v", w.Code, w.Header()) - } -} - func TestRouterNotFound(t *testing.T) { handlerFunc := func(_ http.ResponseWriter, _ *http.Request, _ Params) {}