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

Function Test_App_Use_Params_Group

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

Source from the content-addressed store, hash-verified

1116}
1117
1118func Test_App_Use_Params_Group(t *testing.T) {
1119 t.Parallel()
1120 app := New()
1121
1122 group := app.Group("/prefix/:param/*")
1123 group.Use("/", func(c Ctx) error {
1124 return c.Next()
1125 })
1126 group.Get("/test", func(c Ctx) error {
1127 require.Equal(t, "john", c.Params("param"))
1128 require.Equal(t, "doe", c.Params("*"))
1129 return nil
1130 })
1131
1132 resp, err := app.Test(httptest.NewRequest(MethodGet, "/prefix/john/doe/test", http.NoBody))
1133 require.NoError(t, err, "app.Test(req)")
1134 require.Equal(t, 200, resp.StatusCode, "Status code")
1135}
1136
1137func Test_App_Chaining(t *testing.T) {
1138 t.Parallel()

Callers

nothing calls this directly

Calls 7

TestMethod · 0.80
NewFunction · 0.70
GroupMethod · 0.65
UseMethod · 0.65
NextMethod · 0.65
GetMethod · 0.65
ParamsMethod · 0.65

Tested by

no test coverage detected