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

Function Test_Response_Header

client/response_test.go:183–203  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

181}
182
183func Test_Response_Header(t *testing.T) {
184 t.Parallel()
185
186 server := startTestServer(t, func(app *fiber.App) {
187 app.Get("/", func(c fiber.Ctx) error {
188 c.Response().Header.Add("foo", "bar")
189 return c.SendString("helo world")
190 })
191 })
192 defer server.stop()
193
194 client := New().SetDial(server.dial())
195
196 resp, err := AcquireRequest().
197 SetClient(client).
198 Get("http://example.com")
199
200 require.NoError(t, err)
201 require.Equal(t, "bar", resp.Header("foo"))
202 resp.Close()
203}
204
205func Test_Response_Headers(t *testing.T) {
206 t.Parallel()

Callers

nothing calls this directly

Calls 13

startTestServerFunction · 0.85
AcquireRequestFunction · 0.85
stopMethod · 0.80
dialMethod · 0.80
SetClientMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
AddMethod · 0.65
ResponseMethod · 0.65
SendStringMethod · 0.65
SetDialMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected