Skip to content

Commit

Permalink
fixed default routes for group
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Oct 30, 2016
1 parent 8b8aac8 commit 58166d5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 58166d5

Please sign in to comment.