mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
fix(nuxt3): remove undefined headers in useRequestHeaders (#2526)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
04b6466d37
commit
1e98259368
@ -7,5 +7,5 @@ export function useRequestHeaders (include?) {
|
||||
if (process.client) { return {} }
|
||||
const headers: Record<string, string> = useNuxtApp().ssrContext?.req.headers ?? {}
|
||||
if (!include) { return headers }
|
||||
return Object.fromEntries(include.map(key => [key, headers[key]]))
|
||||
return Object.fromEntries(include.filter(key => headers[key]).map(key => [key, headers[key]]))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user