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

Function Test_Request_Get

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

Source from the content-addressed store, hash-verified

883}
884
885func Test_Request_Get(t *testing.T) {
886 t.Parallel()
887
888 app, ln, start := createHelperServer(t)
889 app.Get("/", func(c fiber.Ctx) error {
890 return c.SendString(c.Hostname())
891 })
892
893 go start()
894 time.Sleep(100 * time.Millisecond)
895
896 client := New().SetDial(ln)
897
898 for range 5 {
899 req := AcquireRequest().SetClient(client)
900
901 resp, err := req.Get("http://example.com")
902 require.NoError(t, err)
903 require.Equal(t, fiber.StatusOK, resp.StatusCode())
904 require.Equal(t, "example.com", resp.String())
905 resp.Close()
906 }
907}
908
909func Test_Request_Post(t *testing.T) {
910 t.Parallel()

Callers

nothing calls this directly

Calls 11

createHelperServerFunction · 0.85
AcquireRequestFunction · 0.85
SetClientMethod · 0.80
NewFunction · 0.70
GetMethod · 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