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

Function Test_NextCustom_SkipNonUseRoutesSkipsFallback

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

Source from the content-addressed store, hash-verified

1978}
1979
1980func Test_NextCustom_SkipNonUseRoutesSkipsFallback(t *testing.T) {
1981 t.Parallel()
1982
1983 app := newCustomApp()
1984 app.Get("/foo", func(c Ctx) error { return c.SendStatus(StatusOK) })
1985 app.startupProcess()
1986
1987 fctx := &fasthttp.RequestCtx{}
1988 fctx.Request.Header.SetMethod(MethodPost)
1989 fctx.Request.SetRequestURI("/foo")
1990
1991 ctx := app.AcquireCtx(fctx)
1992 ctx.setSkipNonUseRoutes(true)
1993 defer app.ReleaseCtx(ctx)
1994
1995 matched, err := app.nextCustom(ctx)
1996 require.False(t, matched)
1997 require.NoError(t, err)
1998 require.Empty(t, ctx.Response().Header.Peek(HeaderAllow))
1999}
2000
2001func Test_NextCustom_NotFound(t *testing.T) {
2002 t.Parallel()

Callers

nothing calls this directly

Calls 10

newCustomAppFunction · 0.85
startupProcessMethod · 0.80
SetMethodMethod · 0.80
AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
nextCustomMethod · 0.80
GetMethod · 0.65
SendStatusMethod · 0.65
setSkipNonUseRoutesMethod · 0.65
ResponseMethod · 0.65

Tested by

no test coverage detected