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

Function Benchmark_Headers

client/response_test.go:243–281  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

241}
242
243func Benchmark_Headers(b *testing.B) {
244 server := startTestServer(
245 b,
246 func(app *fiber.App) {
247 app.Get("/", func(c fiber.Ctx) error {
248 c.Response().Header.Add("foo", "bar")
249 c.Response().Header.Add("foo", "bar2")
250 c.Response().Header.Add("foo", "bar3")
251
252 c.Response().Header.Add("foo2", "bar")
253 c.Response().Header.Add("foo2", "bar2")
254 c.Response().Header.Add("foo2", "bar3")
255
256 return c.SendString("helo world")
257 })
258 },
259 )
260
261 client := New().SetDial(server.dial())
262
263 resp, err := AcquireRequest().
264 SetClient(client).
265 Get("http://example.com")
266 require.NoError(b, err)
267
268 b.Cleanup(func() {
269 resp.Close()
270 server.stop()
271 })
272
273 b.ReportAllocs()
274
275 for b.Loop() {
276 for k, v := range resp.Headers() {
277 _ = k
278 _ = v
279 }
280 }
281}
282
283func Test_Response_Cookie(t *testing.T) {
284 t.Parallel()

Callers

nothing calls this directly

Calls 13

startTestServerFunction · 0.85
AcquireRequestFunction · 0.85
dialMethod · 0.80
SetClientMethod · 0.80
stopMethod · 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