From 31e795315a5696d6984dea3d4ae3905c03afde7e Mon Sep 17 00:00:00 2001 From: takaya kusanagi Date: Wed, 29 Aug 2018 10:50:58 +0900 Subject: [PATCH] change getting method point after overriding method in premiddleware (#1182) --- echo.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/echo.go b/echo.go index e017816e..66b005e3 100644 --- a/echo.go +++ b/echo.go @@ -557,18 +557,17 @@ func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) { c := e.pool.Get().(*context) c.Reset(r, w) - m := r.Method h := NotFoundHandler if e.premiddleware == nil { - e.router.Find(m, getPath(r), c) + e.router.Find(r.Method, getPath(r), c) h = c.Handler() for i := len(e.middleware) - 1; i >= 0; i-- { h = e.middleware[i](h) } } else { h = func(c Context) error { - e.router.Find(m, getPath(r), c) + e.router.Find(r.Method, getPath(r), c) h := c.Handler() for i := len(e.middleware) - 1; i >= 0; i-- { h = e.middleware[i](h)