mirror of
https://github.com/labstack/echo.git
synced 2024-11-28 08:38:39 +02:00
parent
e4ab053bc8
commit
2d6aaa8a33
5
echo.go
5
echo.go
@ -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,
|
||||
|
5
group.go
5
group.go
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user