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

Function Test_Route_Match_Middleware_Root

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

Source from the content-addressed store, hash-verified

720}
721
722func Test_Route_Match_Middleware_Root(t *testing.T) {
723 t.Parallel()
724
725 app := New()
726
727 app.Use("/", func(c Ctx) error {
728 return c.SendString("middleware")
729 })
730
731 resp, err := app.Test(httptest.NewRequest(MethodGet, "/everything", http.NoBody))
732 require.NoError(t, err, "app.Test(req)")
733 require.Equal(t, 200, resp.StatusCode, "Status code")
734
735 body, err := io.ReadAll(resp.Body)
736 require.NoError(t, err, "app.Test(req)")
737 require.Equal(t, "middleware", app.toString(body))
738}
739
740func Test_Router_Register_Missing_Handler(t *testing.T) {
741 t.Parallel()

Callers

nothing calls this directly

Calls 5

TestMethod · 0.80
toStringMethod · 0.80
NewFunction · 0.70
UseMethod · 0.65
SendStringMethod · 0.65

Tested by

no test coverage detected