mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
change getting method point after overriding method in premiddleware (#1182)
This commit is contained in:
parent
b369096cac
commit
31e795315a
5
echo.go
5
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)
|
||||
|
Loading…
Reference in New Issue
Block a user