1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-12 01:22:21 +02:00

Merge pull request #1607 from BUGLAN/fix/dupl

Fix duplicate code for applyMiddleware
This commit is contained in:
Roland Lammel 2020-07-20 13:45:57 +02:00 committed by GitHub
commit 165648d4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -504,11 +504,7 @@ func (e *Echo) add(host, method, path string, handler HandlerFunc, middleware ..
name := handlerName(handler)
router := e.findRouter(host)
router.Add(method, path, func(c Context) error {
h := handler
// Chain middleware
for i := len(middleware) - 1; i >= 0; i-- {
h = middleware[i](h)
}
h := applyMiddleware(handler, middleware...)
return h(c)
})
r := &Route{