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

Function Benchmark_Ctx_Host

ctx_test.go:2963–2973  ·  view source on GitHub ↗

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

(b *testing.B)

Source from the content-addressed store, hash-verified

2961
2962// go test -v -run=^$ -bench=Benchmark_Ctx_Host -benchmem -count=4
2963func Benchmark_Ctx_Host(b *testing.B) {
2964 app := New()
2965 c := app.AcquireCtx(&fasthttp.RequestCtx{})
2966 c.Request().SetRequestURI("http://google.com/test")
2967 var host string
2968 b.ReportAllocs()
2969 for b.Loop() {
2970 host = c.Host()
2971 }
2972 require.Equal(b, "google.com", host)
2973}
2974
2975// go test -run Test_Ctx_IsProxyTrusted
2976func Test_Ctx_IsProxyTrusted(t *testing.T) {

Callers

nothing calls this directly

Calls 4

AcquireCtxMethod · 0.80
NewFunction · 0.70
RequestMethod · 0.65
HostMethod · 0.65

Tested by

no test coverage detected