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

Function Benchmark_Ctx_Is

ctx_test.go:4003–4015  ·  view source on GitHub ↗

go test -v -run=^$ -bench=Benchmark_Ctx_Is -benchmem -count=4

(b *testing.B)

Source from the content-addressed store, hash-verified

4001
4002// go test -v -run=^$ -bench=Benchmark_Ctx_Is -benchmem -count=4
4003func Benchmark_Ctx_Is(b *testing.B) {
4004 app := New()
4005 c := app.AcquireCtx(&fasthttp.RequestCtx{})
4006
4007 c.Request().Header.Set(HeaderContentType, MIMEApplicationJSON)
4008 var res bool
4009 b.ReportAllocs()
4010 for b.Loop() {
4011 _ = c.Is(".json")
4012 res = c.Is("json")
4013 }
4014 require.True(b, res)
4015}
4016
4017// go test -run Test_Ctx_Locals
4018func Test_Ctx_Locals(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AcquireCtxMethod · 0.80
NewFunction · 0.70
SetMethod · 0.65
RequestMethod · 0.65
IsMethod · 0.65

Tested by

no test coverage detected