MCPcopy
hub / github.com/gofiber/fiber / Test_NextCustom_SkipMountAndNoHandlers

Function Test_NextCustom_SkipMountAndNoHandlers

router_test.go:2053–2074  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2051}
2052
2053func Test_NextCustom_SkipMountAndNoHandlers(t *testing.T) {
2054 t.Parallel()
2055 app := newCustomApp()
2056 m := app.methodInt(MethodGet)
2057 mountR := &Route{path: "/skip", Path: "/skip", routeParser: parseRoute("/skip", regexp.MustCompile), mount: true}
2058 empty := &Route{path: "/foo", Path: "/foo", routeParser: parseRoute("/foo", regexp.MustCompile)}
2059 app.stack[m] = []*Route{mountR, empty}
2060 app.hasRoutesRefreshed = true
2061 app.RebuildTree()
2062
2063 fctx := &fasthttp.RequestCtx{}
2064 fctx.Request.Header.SetMethod(MethodGet)
2065 fctx.Request.SetRequestURI("/foo")
2066
2067 ctx := app.AcquireCtx(fctx)
2068 defer app.ReleaseCtx(ctx)
2069
2070 matched, err := app.nextCustom(ctx)
2071 require.True(t, matched)
2072 require.NoError(t, err)
2073 require.Equal(t, "/foo", ctx.Route().Path)
2074}
2075
2076func Test_AddRoute_MergeHandlers(t *testing.T) {
2077 t.Parallel()

Callers

nothing calls this directly

Calls 9

newCustomAppFunction · 0.85
parseRouteFunction · 0.85
methodIntMethod · 0.80
RebuildTreeMethod · 0.80
SetMethodMethod · 0.80
AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
nextCustomMethod · 0.80
RouteMethod · 0.65

Tested by

no test coverage detected