1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-28 08:38:39 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-03-15 08:33:57 -07:00
parent e4ab053bc8
commit 2d6aaa8a33
2 changed files with 6 additions and 4 deletions

View File

@ -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,

View File

@ -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,