Skip to content
API/readHeader

readHeader

src/utils/read-header.tsfunction
readHeader(bag: HeaderBag | null | undefined, name: string): string | null

Read a header value by name from a HeaderBag, regardless of whether the bag exposes a .get() accessor or plain property access.

Parameter Type Description
bag HeaderBag | null | undefined The header bag to read from
name string The header name (case-sensitivity follows the underlying bag)

Returns — The header value, or null if absent or the bag itself is falsy