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

Function Test_Group_Use_NoBoundary

app_test.go:999–1016  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

997}
998
999func Test_Group_Use_NoBoundary(t *testing.T) {
1000 t.Parallel()
1001
1002 app := New()
1003 grp := app.Group("/api")
1004
1005 grp.Use("/foo", func(c Ctx) error {
1006 return c.SendStatus(StatusOK)
1007 })
1008
1009 resp, err := app.Test(httptest.NewRequest(MethodGet, "/api/foo/bar", http.NoBody))
1010 require.NoError(t, err, "app.Test(req)")
1011 require.Equal(t, StatusOK, resp.StatusCode, "Status code")
1012
1013 resp, err = app.Test(httptest.NewRequest(MethodGet, "/api/foobar", http.NoBody))
1014 require.NoError(t, err, "app.Test(req)")
1015 require.Equal(t, StatusNotFound, resp.StatusCode, "Status code")
1016}
1017
1018func Test_App_Use_StrictRouting(t *testing.T) {
1019 t.Parallel()

Callers

nothing calls this directly

Calls 5

TestMethod · 0.80
NewFunction · 0.70
GroupMethod · 0.65
UseMethod · 0.65
SendStatusMethod · 0.65

Tested by

no test coverage detected