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

Function Test_Router_NotFound_HTML_Inject

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

Source from the content-addressed store, hash-verified

809}
810
811func Test_Router_NotFound_HTML_Inject(t *testing.T) {
812 t.Parallel()
813 app := New()
814 app.Use(func(c Ctx) error {
815 return c.Next()
816 })
817 appHandler := app.Handler()
818 c := &fasthttp.RequestCtx{}
819
820 c.Request.Header.SetMethod("DELETE")
821 c.URI().SetPath("/does/not/exist<script>alert('foo');</script>")
822
823 appHandler(c)
824
825 require.Equal(t, 404, c.Response.StatusCode())
826 require.Equal(t, "Not Found", string(c.Response.Body()))
827}
828
829func registerTreeManipulationRoutes(app *App, middleware ...func(Ctx) error) {
830 converted := make([]any, len(middleware))

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