mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
parent
0473c51f1d
commit
8e421d9773
12
echo.go
12
echo.go
@ -414,9 +414,9 @@ func (e *Echo) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route {
|
|||||||
// Any registers a new route for all HTTP methods and path with matching handler
|
// Any registers a new route for all HTTP methods and path with matching handler
|
||||||
// in the router with optional route-level middleware.
|
// in the router with optional route-level middleware.
|
||||||
func (e *Echo) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route {
|
func (e *Echo) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route {
|
||||||
routes := make([]*Route, 0)
|
routes := make([]*Route, len(methods))
|
||||||
for _, m := range methods {
|
for i, m := range methods {
|
||||||
routes = append(routes, e.Add(m, path, handler, middleware...))
|
routes[i] = e.Add(m, path, handler, middleware...)
|
||||||
}
|
}
|
||||||
return routes
|
return routes
|
||||||
}
|
}
|
||||||
@ -424,9 +424,9 @@ func (e *Echo) Any(path string, handler HandlerFunc, middleware ...MiddlewareFun
|
|||||||
// Match registers a new route for multiple HTTP methods and path with matching
|
// Match registers a new route for multiple HTTP methods and path with matching
|
||||||
// handler in the router with optional route-level middleware.
|
// handler in the router with optional route-level middleware.
|
||||||
func (e *Echo) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route {
|
func (e *Echo) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route {
|
||||||
routes := make([]*Route, 0)
|
routes := make([]*Route, len(methods))
|
||||||
for _, m := range methods {
|
for i, m := range methods {
|
||||||
routes = append(routes, e.Add(m, path, handler, middleware...))
|
routes[i] = e.Add(m, path, handler, middleware...)
|
||||||
}
|
}
|
||||||
return routes
|
return routes
|
||||||
}
|
}
|
||||||
|
16
group.go
16
group.go
@ -71,17 +71,21 @@ func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Any implements `Echo#Any()` for sub-routes within the Group.
|
// Any implements `Echo#Any()` for sub-routes within the Group.
|
||||||
func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) {
|
func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route {
|
||||||
for _, m := range methods {
|
routes := make([]*Route, len(methods))
|
||||||
g.Add(m, path, handler, middleware...)
|
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.
|
// Match implements `Echo#Match()` for sub-routes within the Group.
|
||||||
func (g *Group) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) {
|
func (g *Group) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route {
|
||||||
for _, m := range methods {
|
routes := make([]*Route, len(methods))
|
||||||
g.Add(m, path, handler, middleware...)
|
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.
|
// Group creates a new sub-group with prefix and optional sub-group-level middleware.
|
||||||
|
Loading…
Reference in New Issue
Block a user