summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/labstack/echo/group.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/labstack/echo/group.go')
-rw-r--r--vendor/github.com/labstack/echo/group.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/vendor/github.com/labstack/echo/group.go b/vendor/github.com/labstack/echo/group.go
index 9767bb19..799a8f90 100644
--- a/vendor/github.com/labstack/echo/group.go
+++ b/vendor/github.com/labstack/echo/group.go
@@ -1,8 +1,12 @@
package echo
+import (
+ "path"
+)
+
type (
// Group is a set of sub-routes for a specified route. It can be used for inner
- // routes that share a common middlware or functionality that should be separate
+ // routes that share a common middleware or functionality that should be separate
// from the parent echo instance while still inheriting from it.
Group struct {
prefix string
@@ -14,6 +18,11 @@ type (
// Use implements `Echo#Use()` for sub-routes within the Group.
func (g *Group) Use(middleware ...MiddlewareFunc) {
g.middleware = append(g.middleware, middleware...)
+ // Allow all requests to reach the group as they might get dropped if router
+ // doesn't find a match, making none of the group middleware process.
+ g.echo.Any(path.Clean(g.prefix+"/*"), func(c Context) error {
+ return ErrNotFound
+ }, g.middleware...)
}
// CONNECT implements `Echo#CONNECT()` for sub-routes within the Group.