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

Function Test_App_All_Method_Test

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

Source from the content-addressed store, hash-verified

1078}
1079
1080func Test_App_All_Method_Test(t *testing.T) {
1081 t.Parallel()
1082
1083 methods := append(DefaultMethods, "JOHN") //nolint:gocritic // We want a new slice here
1084 app := New(Config{
1085 RequestMethods: methods,
1086 })
1087
1088 // Add a new method with All
1089 app.All("/doe", testEmptyHandler)
1090
1091 resp, err := app.Test(httptest.NewRequest("JOHN", "/doe", http.NoBody))
1092 require.NoError(t, err, "app.Test(req)")
1093 require.Equal(t, StatusOK, resp.StatusCode, "Status code")
1094
1095 // Add a new method
1096 require.Panics(t, func() {
1097 app.Add([]string{"JANE"}, "/jane", testEmptyHandler)
1098 })
1099}
1100
1101// go test -run Test_App_GETOnly
1102func Test_App_GETOnly(t *testing.T) {

Callers

nothing calls this directly

Calls 4

TestMethod · 0.80
NewFunction · 0.70
AllMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected