(b *testing.B)
| 3822 | } |
| 3823 | |
| 3824 | func Benchmark_Cache_AdditionalHeaders(b *testing.B) { |
| 3825 | app := fiber.New() |
| 3826 | app.Use(New(Config{ |
| 3827 | StoreResponseHeaders: true, |
| 3828 | })) |
| 3829 | |
| 3830 | app.Get("/demo", func(c fiber.Ctx) error { |
| 3831 | c.Response().Header.Add("X-Foobar", "foobar") |
| 3832 | return c.SendStatus(418) |
| 3833 | }) |
| 3834 | |
| 3835 | h := app.Handler() |
| 3836 | |
| 3837 | fctx := &fasthttp.RequestCtx{} |
| 3838 | fctx.Request.Header.SetMethod(fiber.MethodGet) |
| 3839 | fctx.Request.SetRequestURI("/demo") |
| 3840 | |
| 3841 | b.ReportAllocs() |
| 3842 | |
| 3843 | for b.Loop() { |
| 3844 | h(fctx) |
| 3845 | } |
| 3846 | |
| 3847 | require.Equal(b, fiber.StatusTeapot, fctx.Response.Header.StatusCode()) |
| 3848 | require.Equal(b, []byte("foobar"), fctx.Response.Header.Peek("X-Foobar")) |
| 3849 | } |
| 3850 | |
| 3851 | func Benchmark_Cache_QueryMethod(b *testing.B) { |
| 3852 | app := fiber.New() |
nothing calls this directly
no test coverage detected