-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
useFetch POST with headers and body does not pass headers properly (node v18) #14268
Comments
This wil likely be resolved when we merge unjs/h3#119. We need to provide a normalized For now, note that the following are the different ways of reading the headers object. // internal request via $fetch to /api/call
console.log(event.req.headers.get('cookie'))
// external request direct to /api/call
console.log(event.req.headers.cookie) |
Node.js We are moving to use more Web-native interfaces in the future in h3 and reduce direct usage of |
Environment
Darwin
v18.3.0
3.0.0-rc.4
[email protected]
vite
-
-
-
Reproduction
Describe the bug
When body is passed to the post the headers arrive to the API handler as follows (event.req.headers) as a Map object:
In this case it is not possible to access the passed headers by key (event.req.headers.keyname) and use the composables like useCookie.
When the body is not defined the headers arrive as a plain object:
This happens only running the 18th Node. On earlier 16th the headers arrive as a plain object.
Found workaround
a server middleware fixes the problem by converting a map into a plain object
The text was updated successfully, but these errors were encountered: