Response does not contain headers
kingyue737 opened this issue · comments
Environment
- Operating System: Linux
- Node Version: v18.18.0
- Nuxt Version: 3.10.3
- CLI Version: 3.10.1
- Nitro Version: 2.8.1
- Package Manager: npm@10.2.3
- Builder: -
- User Config: devtools
- Runtime Modules: -
- Build Modules: -
Reproduction
stackblitz.com/edit/nuxt-starter-knny4w
Describe the bug
$fetch.raw
returns a response without headers. It should contain headers.
Additional context
It's originally posted in #350 as a feature request but I think it is rather a bug so I am reposting it here with reproduction.
Logs
No response
By the way, I have a question. Why ofetch
has ofetch.native
but $fetch
in nuxt does not have $fetch.native
?
https://developer.mozilla.org/en-US/docs/Web/API/Response/headers
https://developer.mozilla.org/en-US/docs/Web/API/Headers
You can use Array.from(response.headers.keys())
to get all the keys, and headers.get(key)
to get the values.