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

Function TestRoute_ForGroup

route_test.go:136–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

134}
135
136func TestRoute_ForGroup(t *testing.T) {
137 route := Route{
138 Method: http.MethodGet,
139 Path: "/test",
140 Handler: func(c *Context) error {
141 return c.String(http.StatusTeapot, "OK")
142 },
143 Middlewares: nil,
144 Name: "test route",
145 }
146
147 mw := func(next HandlerFunc) HandlerFunc {
148 return func(c *Context) error {
149 return next(c)
150 }
151 }
152 r := route.WithPrefix("/users", []MiddlewareFunc{mw})
153
154 assert.Equal(t, r.Method, http.MethodGet)
155 assert.Equal(t, r.Path, "/users/test")
156 assert.NotNil(t, r.Handler)
157 assert.Len(t, r.Middlewares, 1)
158 assert.Equal(t, r.Name, "test route")
159}
160
161func exampleRoutes() Routes {
162 return Routes{

Callers

nothing calls this directly

Calls 2

WithPrefixMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…