Add support for HTTP 405
diff --git a/router.go b/router.go index 7716dc7..1028c03 100644 --- a/router.go +++ b/router.go
@@ -313,6 +313,18 @@ } } + // 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, "405 method not allowed", http.StatusMethodNotAllowed) + return + } + } + // Handle 404 if r.NotFound != nil { r.NotFound(w, req)