Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 tasks done
benjajaja opened this issue Mar 7, 2023 · 3 comments · Fixed by #2369 or #2751

Comments

@benjajaja
Copy link
Contributor

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.
@welcome
Copy link

welcome bot commented Mar 7, 2023

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@ReneWerner87
Copy link
Member

@benjajaja can you help us with a pull request?

@benjajaja
Copy link
Contributor Author

yea I can find some time

benjajaja added a commit to benjajaja/fiber that referenced this issue Mar 13, 2023
Consistent with c.Locals(key inteface{}, ...).
Fixes gofiber#2356
benjajaja added a commit to benjajaja/fiber that referenced this issue Mar 13, 2023
Consistent with c.Locals(key inteface{}, ...).
Fixes gofiber#2356
ReneWerner87 pushed a commit that referenced this issue Mar 14, 2023
requestid.Config.ContextKey is interface{}

Consistent with c.Locals(key inteface{}, ...).
Fixes #2356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment