diff options
author | Wim <wim@42.be> | 2018-02-21 00:48:10 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-02-21 00:48:10 +0100 |
commit | 55ab0c12f12e2f0ee15dccd519e1fca4d011b73b (patch) | |
tree | 8d114d1129424e446a0124b9520d2ff3b2175369 /vendor/github.com/labstack/echo/group.go | |
parent | d1227b5fc9de9f7a04fbf71292dd224aa8806411 (diff) | |
download | matterbridge-msglm-55ab0c12f12e2f0ee15dccd519e1fca4d011b73b.tar.gz matterbridge-msglm-55ab0c12f12e2f0ee15dccd519e1fca4d011b73b.tar.bz2 matterbridge-msglm-55ab0c12f12e2f0ee15dccd519e1fca4d011b73b.zip |
Update vendor labstack/echo
Diffstat (limited to 'vendor/github.com/labstack/echo/group.go')
-rw-r--r-- | vendor/github.com/labstack/echo/group.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/vendor/github.com/labstack/echo/group.go b/vendor/github.com/labstack/echo/group.go index 6ae32372..f7e61a2e 100644 --- a/vendor/github.com/labstack/echo/group.go +++ b/vendor/github.com/labstack/echo/group.go @@ -20,9 +20,11 @@ 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 NotFoundHandler(c) - }, g.middleware...) + for _, p := range []string{"", "/*"} { + g.echo.Any(path.Clean(g.prefix+p), func(c Context) error { + return NotFoundHandler(c) + }, g.middleware...) + } } // CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. @@ -71,17 +73,21 @@ func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route { } // Any implements `Echo#Any()` for sub-routes within the Group. -func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) { - for _, m := range methods { - g.Add(m, path, handler, middleware...) +func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route { + routes := make([]*Route, len(methods)) + for i, m := range methods { + routes[i] = g.Add(m, path, handler, middleware...) } + return routes } // Match implements `Echo#Match()` for sub-routes within the Group. -func (g *Group) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) { - for _, m := range methods { - g.Add(m, path, handler, middleware...) +func (g *Group) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route { + routes := make([]*Route, len(methods)) + for i, m := range methods { + routes[i] = g.Add(m, path, handler, middleware...) } + return routes } // Group creates a new sub-group with prefix and optional sub-group-level middleware. |