fix(nuxt): `useRequestHeaders` type should allow for `undefined` values (#5748)

This commit is contained in:
Daniel Roe 2022-07-06 20:00:08 +01:00 committed by GitHub
parent aa9950cfb3
commit 490d686fe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -3,8 +3,8 @@ import type { CompatibilityEvent } from 'h3'
import { useNuxtApp } from '#app'
import { NuxtApp } from '#app/nuxt'
export function useRequestHeaders<K extends string = string> (include: K[]): Record<K, string>;
export function useRequestHeaders (): Readonly<Record<string, string>>;
export function useRequestHeaders<K extends string = string> (include: K[]): Record<K, string | undefined>
export function useRequestHeaders (): Readonly<Record<string, string | undefined>>
export function useRequestHeaders (include?) {
if (process.client) { return {} }
const headers: Record<string, string | string[]> = useNuxtApp().ssrContext?.event.req.headers ?? {}