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

Function Test_Request_Options

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

Source from the content-addressed store, hash-verified

1014}
1015
1016func Test_Request_Options(t *testing.T) {
1017 t.Parallel()
1018
1019 app, ln, start := createHelperServer(t)
1020
1021 app.Options("/", func(c fiber.Ctx) error {
1022 return c.Status(fiber.StatusOK).
1023 SendString("options")
1024 })
1025
1026 go start()
1027 time.Sleep(100 * time.Millisecond)
1028
1029 client := New().SetDial(ln)
1030
1031 for range 5 {
1032 resp, err := AcquireRequest().
1033 SetClient(client).
1034 Options("http://example.com")
1035
1036 require.NoError(t, err)
1037 require.Equal(t, fiber.StatusOK, resp.StatusCode())
1038 require.Equal(t, "options", resp.String())
1039
1040 resp.Close()
1041 }
1042}
1043
1044func Test_Request_Send(t *testing.T) {
1045 t.Parallel()

Callers

nothing calls this directly

Calls 11

createHelperServerFunction · 0.85
AcquireRequestFunction · 0.85
SetClientMethod · 0.80
NewFunction · 0.70
OptionsMethod · 0.65
SendStringMethod · 0.65
StatusMethod · 0.65
SetDialMethod · 0.65
StringMethod · 0.65
CloseMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected