Skip to content

Commit

Permalink
Merge pull request #1607 from BUGLAN/fix/dupl
Browse files Browse the repository at this point in the history
Fix duplicate code for applyMiddleware
  • Loading branch information
lammel authored Jul 20, 2020
2 parents a151cbb + 546639c commit 165648d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 165648d

Please sign in to comment.