fiber/docs/api
Benjamin Grosse b1850834a3
fix: don't constrain middlewares' context-keys to strings 🐛 (#2751)
* Revert "Revert "🐛 requestid.Config.ContextKey is interface{} (#2369)" (#2742)"

This reverts commit 28be17f929.

* fix: request ContextKey default value condition

Should check for `nil` since it is `any`.

* fix: don't constrain middlewares' context-keys to strings

`context` recommends using "unexported type" as context keys to avoid
collisions https://pkg.go.dev/github.com/gofiber/fiber/v2#Ctx.Locals.

The official go blog also recommends this https://go.dev/blog/context.

`fiber.Ctx.Locals(key any, value any)` correctly allows consumers to
use unexported types or e.g. strings.

But some fiber middlewares constrain their context-keys to `string` in
their "default config structs", making it impossible to use unexported
types.

This PR removes the `string` _constraint_ from all middlewares, allowing
to now use unexported types as per the official guidelines. However
the default value is still a string, so it's not a breaking change, and
anyone still using strings as context keys is not affected.
2023-12-12 14:55:29 +01:00
..
middleware fix: don't constrain middlewares' context-keys to strings 🐛 (#2751) 2023-12-12 14:55:29 +01:00
_category_.json 📝 docs: automated synchronization with `gofiber/docs` (#2344) 2023-02-25 10:29:07 +01:00
app.md 📝 Docs: update io/ioutil package to io package (#2589) 2023-08-22 08:57:00 +02:00
client.md refresh docs for 2023-11-15 09:23:08 +01:00
constants.md 📝 docs: automated synchronization with `gofiber/docs` (#2344) 2023-02-25 10:29:07 +01:00
ctx.md refresh docs for 2023-11-15 09:23:08 +01:00
fiber.md 🔥 add config to enable splitting by comma in parsers (#2560) 2023-08-21 09:44:02 +02:00
log.md Update log.md 2023-07-16 16:18:23 +02:00