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

Function Test_Route_Match_Middleware_HasPrefix

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

Source from the content-addressed store, hash-verified

688}
689
690func Test_Route_Match_Middleware_HasPrefix(t *testing.T) {
691 t.Parallel()
692
693 app := New()
694
695 app.Use("/foo", func(c Ctx) error {
696 return c.SendString("middleware")
697 })
698
699 resp, err := app.Test(httptest.NewRequest(MethodGet, "/foo/bar", http.NoBody))
700 require.NoError(t, err, "app.Test(req)")
701 require.Equal(t, 200, resp.StatusCode, "Status code")
702
703 body, err := io.ReadAll(resp.Body)
704 require.NoError(t, err, "app.Test(req)")
705 require.Equal(t, "middleware", app.toString(body))
706}
707
708func Test_Route_Match_Middleware_NoBoundary(t *testing.T) {
709 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