Skip to content

🐛 [Bug]: requestId middleware still only accepts string for ContextKey config value, should be any like c.Locals. #2356

@benjajaja

Description

@benjajaja

Bug Description

#2143 allows to use any as key for c.Locals(key, v). The RequestID middleware should be consistent with that.
This allows to use a custom type for context keys, like for other keys. The RequestID is likely read back somewhere else along other context keys.

How to Reproduce

See https://docs.gofiber.io/api/middleware/requestid#config

Expected Behavior

https://docs.gofiber.io/api/middleware/requestid#config should have ContextKey interface{}

Fiber Version

v2.42.0

Code Snippet (optional)

No response

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

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions