Skip to content

Commit

Permalink
Fixed labstack#405
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Mar 15, 2016
1 parent e4ab053 commit 2d6aaa8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,11 @@ func (e *Echo) File(path, file string) {
func (e *Echo) add(method, path string, handler Handler, middleware ...Middleware) {
name := handlerName(handler)
e.router.Add(method, path, HandlerFunc(func(c Context) error {
h := handler
for _, m := range middleware {
handler = m.Handle(handler)
h = m.Handle(h)
}
return handler.Handle(c)
return h.Handle(c)
}), e)
r := Route{
Method: method,
Expand Down
5 changes: 3 additions & 2 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ func (g *Group) add(method, path string, handler Handler, middleware ...Middlewa
middleware = append(g.middleware, middleware...)

g.echo.router.Add(method, path, HandlerFunc(func(c Context) error {
h := handler
for _, m := range middleware {
handler = m.Handle(handler)
h = m.Handle(h)
}
return handler.Handle(c)
return h.Handle(c)
}), g.echo)
r := Route{
Method: method,
Expand Down

0 comments on commit 2d6aaa8

Please sign in to comment.