MCPcopy Index your code
hub / github.com/labstack/echo / Match

Method Match

group.go:77–97  ·  view source on GitHub ↗

Match implements `Echo#Match()` for sub-routes within the Group. Panics on error.

(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc)

Source from the content-addressed store, hash-verified

75
76// Match implements `Echo#Match()` for sub-routes within the Group. Panics on error.
77func (g *Group) Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes {
78 errs := make([]error, 0)
79 ris := make(Routes, 0)
80 for _, m := range methods {
81 ri, err := g.AddRoute(Route{
82 Method: m,
83 Path: path,
84 Handler: handler,
85 Middlewares: middleware,
86 })
87 if err != nil {
88 errs = append(errs, err)
89 continue
90 }
91 ris = append(ris, ri)
92 }
93 if len(errs) > 0 {
94 panic(errs) // this is how `v4` handles errors. `v5` has methods to have panic-free usage
95 }
96 return ris
97}
98
99// Group creates a new sub-group with prefix and optional sub-group-level middleware.
100// Important! Group middlewares are only executed in case there was exact route match and not

Callers

nothing calls this directly

Calls 1

AddRouteMethod · 0.95

Tested by

no test coverage detected