From 1e982593680f80b9c9b0c376e3314f005b1005fe Mon Sep 17 00:00:00 2001 From: Vladyslav Poshvaniuk Date: Fri, 24 Dec 2021 00:33:10 +0200 Subject: [PATCH] fix(nuxt3): remove undefined headers in useRequestHeaders (#2526) Co-authored-by: Pooya Parsa --- packages/nuxt3/src/app/composables/ssr.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt3/src/app/composables/ssr.ts b/packages/nuxt3/src/app/composables/ssr.ts index f4fcf88309..9cd19c3801 100644 --- a/packages/nuxt3/src/app/composables/ssr.ts +++ b/packages/nuxt3/src/app/composables/ssr.ts @@ -7,5 +7,5 @@ export function useRequestHeaders (include?) { if (process.client) { return {} } const headers: Record = 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]])) }