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

Function NewWithCustomCtx

app.go:793–797  ·  view source on GitHub ↗

NewWithCustomCtx creates a new Fiber instance and applies the provided function to generate a custom context type. It mirrors the behavior of calling `New()` followed by `app.setCtxFunc(fn)`.

(newCtxFunc func(app *App) CustomCtx, config ...Config)

Source from the content-addressed store, hash-verified

791// provided function to generate a custom context type. It mirrors the behavior
792// of calling `New()` followed by `app.setCtxFunc(fn)`.
793func NewWithCustomCtx(newCtxFunc func(app *App) CustomCtx, config ...Config) *App {
794 app := New(config...)
795 app.setCtxFunc(newCtxFunc)
796 return app
797}
798
799// GetString returns s unchanged when Immutable is off or s is read-only (rodata).
800// Otherwise, it returns a detached copy (strings.Clone).

Callers 6

TestValueFromContextFunction · 0.85
newCustomAppFunction · 0.85
Test_Ctx_CustomCtxFunction · 0.85

Calls 2

setCtxFuncMethod · 0.80
NewFunction · 0.70

Tested by 6

TestValueFromContextFunction · 0.68
newCustomAppFunction · 0.68
Test_Ctx_CustomCtxFunction · 0.68