Ignore OPTIONS as allowed method
Updates #98
diff --git a/router.go b/router.go
index 1f7bbe9..5d6c81c 100644
--- a/router.go
+++ b/router.go
@@ -338,7 +338,7 @@
var allow string
for method := range r.trees {
// Skip the requested method - we already tried this one
- if method == req.Method {
+ if method == req.Method || method == "OPTIONS" {
continue
}
diff --git a/router_test.go b/router_test.go
index 0924d48..265bd55 100644
--- a/router_test.go
+++ b/router_test.go
@@ -234,6 +234,7 @@
// add another method
router.DELETE("/path", handlerFunc)
+ router.OPTIONS("/path", handlerFunc) // must be ignored
// test again
r, _ = http.NewRequest("GET", "/path", nil)