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

Function Test_Request_Patch

client/request_test.go:1074–1100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1072}
1073
1074func Test_Request_Patch(t *testing.T) {
1075 t.Parallel()
1076
1077 app, ln, start := createHelperServer(t)
1078
1079 app.Patch("/", func(c fiber.Ctx) error {
1080 return c.SendString(c.FormValue("foo"))
1081 })
1082
1083 go start()
1084 time.Sleep(100 * time.Millisecond)
1085
1086 client := New().SetDial(ln)
1087
1088 for range 5 {
1089 resp, err := AcquireRequest().
1090 SetClient(client).
1091 SetFormData("foo", "bar").
1092 Patch("http://example.com")
1093
1094 require.NoError(t, err)
1095 require.Equal(t, fiber.StatusOK, resp.StatusCode())
1096 require.Equal(t, "bar", resp.String())
1097
1098 resp.Close()
1099 }
1100}
1101
1102func Test_Request_Query(t *testing.T) {
1103 t.Parallel()

Callers

nothing calls this directly

Calls 12

createHelperServerFunction · 0.85
AcquireRequestFunction · 0.85
SetFormDataMethod · 0.80
SetClientMethod · 0.80
NewFunction · 0.70
PatchMethod · 0.65
SendStringMethod · 0.65
FormValueMethod · 0.65
SetDialMethod · 0.65
StringMethod · 0.65
CloseMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected