-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Bug Description
Issue 1
I had to use the following signature for custom context
type MyContext struct {
fiber.DefaultCtx
}
app.NewCtxFunc(func(app *fiber.App) fiber.CustomCtx { /* correction: fiber.Ctx is documented */
return &MyContext{
DefaultCtx: *fiber.NewDefaultCtx(app), /* correction: Ctx is documented */
}
})
Issue 2
app := fiber.New()
app.NewCtxFunc(func(app *fiber.App) fiber.CustomCtx {
return &MyContext{
DefaultCtx: *fiber.NewDefaultCtx(app),
}
})
app.Use(logger.New()) /* when used MyContext is not carried forward */
app.Get("/", func(c fiber.Ctx) error {
myCtx := c.(*MyContext)
}
app.Listen(":8080")
panic: as c here is *DefaultCtx
How to Reproduce
Run and make request http://localhost:8080/
Expected Behavior
myCtx := c.(*MyContext)
this should work even when middleware is used.
Fiber Version
3.0.0-beta4
Code Snippet (optional)
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my problem prior to opening this one.
- I understand that improperly formatted bug reports may be closed without explanation.
Metadata
Metadata
Assignees
Type
Projects
Status
No status