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

Function Test_Request_Head

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

Source from the content-addressed store, hash-verified

934}
935
936func Test_Request_Head(t *testing.T) {
937 t.Parallel()
938
939 app, ln, start := createHelperServer(t)
940 app.Head("/", func(c fiber.Ctx) error {
941 return c.SendString(c.Hostname())
942 })
943
944 go start()
945 time.Sleep(100 * time.Millisecond)
946
947 client := New().SetDial(ln)
948
949 for range 5 {
950 resp, err := AcquireRequest().
951 SetClient(client).
952 Head("http://example.com")
953
954 require.NoError(t, err)
955 require.Equal(t, fiber.StatusOK, resp.StatusCode())
956 require.Empty(t, resp.String())
957 resp.Close()
958 }
959}
960
961func Test_Request_Put(t *testing.T) {
962 t.Parallel()

Callers

nothing calls this directly

Calls 11

createHelperServerFunction · 0.85
AcquireRequestFunction · 0.85
SetClientMethod · 0.80
NewFunction · 0.70
HeadMethod · 0.65
SendStringMethod · 0.65
HostnameMethod · 0.65
SetDialMethod · 0.65
StringMethod · 0.65
CloseMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected