mirror of
https://github.com/labstack/echo.git
synced 2025-02-17 14:01:16 +02:00
fixed default routes for group
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
8b8aac8aef
commit
58166d599b
9
group.go
9
group.go
@ -17,10 +17,15 @@ func (g *Group) Use(middleware ...MiddlewareFunc) {
|
||||
// Allow requests `/prefix & /prefix/*` to reach the group as they might get
|
||||
// dropped if router doesn't find a match, making none of the group middleware
|
||||
// execute.
|
||||
paths := []string{"/*"}
|
||||
if g.prefix == "" {
|
||||
g.Any("/", NotFoundHandler, g.middleware...)
|
||||
paths = append(paths, "/")
|
||||
} else {
|
||||
paths = append(paths, "")
|
||||
}
|
||||
for _, p := range paths {
|
||||
g.Any(p, NotFoundHandler, g.middleware...)
|
||||
}
|
||||
g.Any("/*", NotFoundHandler, g.middleware...)
|
||||
}
|
||||
|
||||
// CONNECT implements `Echo#CONNECT()` for sub-routes within the Group.
|
||||
|
Loading…
x
Reference in New Issue
Block a user