From 9e4d886a6cddef195dae1315356ed6c3753c8e24 Mon Sep 17 00:00:00 2001 From: astaxie Date: Thu, 7 Nov 2013 22:10:46 +0800 Subject: [PATCH] filter http method fix #279 --- router.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/router.go b/router.go index 14a9b7a7..c219ead9 100644 --- a/router.go +++ b/router.go @@ -311,6 +311,11 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) context.Input.CruSession = GlobalSessions.SessionStart(w, r) } + if !inSlice(strings.ToLower(r.Method), HTTPMETHOD) { + http.Error(w, "Method Not Allowed", 405) + return + } + var runrouter *controllerInfo var findrouter bool