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

Method AcquireCtx

ctx_interface.go:66–78  ·  ctx_interface.go::App.AcquireCtx

AcquireCtx retrieves a new Ctx from the pool.

(fctx *fasthttp.RequestCtx)

Source from the content-addressed store, hash-verified

64
65// AcquireCtx retrieves a new Ctx from the pool.
66func (app *App) AcquireCtx(fctx *fasthttp.RequestCtx) CustomCtx {
67 ctx, ok := app.pool.Get().(CustomCtx)
68
69 if !ok {
70 panic(errCustomCtxTypeAssertion)
71 }
72
73 app.setHandlerCtxIfNeeded(ctx)
74
75 ctx.Reset(fctx)
76
77 return ctx
78}
79
80func (app *App) setHandlerCtxIfNeeded(ctx CustomCtx) {
81 if app.hasCustomCtx || isCustomCtx(ctx) {

Calls 3

setHandlerCtxIfNeededMethod · 0.95
GetMethod · 0.65
ResetMethod · 0.65