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

Function Test_Ctx_ForceReleaseClearsAbandon

ctx_test.go:9472–9485  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9470}
9471
9472func Test_Ctx_ForceReleaseClearsAbandon(t *testing.T) {
9473 t.Parallel()
9474
9475 app := New()
9476 ctx := app.AcquireCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck,forcetypeassert // controlled test setup
9477 ctx.route = &Route{}
9478
9479 ctx.Abandon()
9480 ctx.ForceRelease()
9481
9482 require.False(t, ctx.IsAbandoned(), "ForceRelease should clear abandon flag")
9483 require.Nil(t, ctx.fasthttp, "ForceRelease should release fasthttp reference")
9484 require.Nil(t, ctx.route, "ForceRelease should reset route before pooling")
9485}
9486
9487// go test -v -run=^$ -bench=Benchmark_Ctx_IsProxyTrusted -benchmem -count=4
9488func Benchmark_Ctx_IsProxyTrusted(b *testing.B) {

Callers

nothing calls this directly

Calls 5

AcquireCtxMethod · 0.80
NewFunction · 0.70
AbandonMethod · 0.65
ForceReleaseMethod · 0.65
IsAbandonedMethod · 0.65

Tested by

no test coverage detected