1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-07 23:01:56 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-10-22 12:33:29 -07:00
parent 8d97858b68
commit 5a04f8add5

View File

@ -16,11 +16,11 @@ type (
// Use implements `Echo#Use()` for sub-routes within the Group. // Use implements `Echo#Use()` for sub-routes within the Group.
func (g *Group) Use(m ...MiddlewareFunc) { func (g *Group) Use(m ...MiddlewareFunc) {
g.middleware = append(g.middleware, m...) g.middleware = append(g.middleware, m...)
// Allow all requests to reach the group as they might get dropped if router // Allow requests `/prefix & /prefix/*` to reach the group as they might get
// doesn't find a match, making none of the group middleware process. // dropped if router doesn't find a match, making none of the group middleware
g.echo.Any(g.prefix+"*", func(c Context) error { // execute.
return ErrNotFound g.echo.Any(g.prefix, NotFoundHandler, g.middleware...)
}, g.middleware...) g.echo.Any(g.prefix+"/*", NotFoundHandler, g.middleware...)
} }
// CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. // CONNECT implements `Echo#CONNECT()` for sub-routes within the Group.