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

Function Test_Router_NotFound

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

Source from the content-addressed store, hash-verified

791}
792
793func Test_Router_NotFound(t *testing.T) {
794 t.Parallel()
795 app := New()
796 app.Use(func(c Ctx) error {
797 return c.Next()
798 })
799 appHandler := app.Handler()
800 c := &fasthttp.RequestCtx{}
801
802 c.Request.Header.SetMethod("DELETE")
803 c.URI().SetPath("/this/route/does/not/exist")
804
805 appHandler(c)
806
807 require.Equal(t, 404, c.Response.StatusCode())
808 require.Equal(t, "Not Found", string(c.Response.Body()))
809}
810
811func Test_Router_NotFound_HTML_Inject(t *testing.T) {
812 t.Parallel()

Callers

nothing calls this directly

Calls 9

HandlerMethod · 0.80
SetMethodMethod · 0.80
SetPathMethod · 0.80
URIMethod · 0.80
NewFunction · 0.70
UseMethod · 0.65
NextMethod · 0.65
BodyMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected