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
feat(nuxt): useRequestHeader
utility
#24781
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Marking this a draft to write the documentation and make any necessary changes. |
β Live Preview ready!
|
Should I also clarify in the docs that this is used as an abstraction of |
Sure, it would be good to point people to the upstream utility used π |
Thank you! Indeed it is useful to be able to get one specific header π |
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Damian GΕowala <damian.glowala.rebkow@gmail.com>
π Linked issue
β Type of change
π Description
The current request header retrival process of
useRequestHeaders
is a bit unintuitive in situations that require reading headers. It doesn't make a lot of sense from a developmental standpoint as more often than not you would need only a single header, mostly for "reading" operations (I myself have a couple of such use cases, for example, authorization middleware).This PR provides that possibility to simplify and improve DX. With this a person could simply do
That being said, I would like to reiterate and clarify that this is not a replacement of
getRequestHeaders
. This can be used to directly read header values when dealing with authorization related middleware for example, whereas getRequestHeaders can be used to proxy the headers and use them in API calls, due to its object return.π Checklist