diff --git a/src/utils/net/headers.ts b/src/utils/net/headers.ts index 7b912b0..a0209cd 100644 --- a/src/utils/net/headers.ts +++ b/src/utils/net/headers.ts @@ -38,13 +38,18 @@ export function getHeader(headers: Headers, header: string): string | undefined return undefined; } + if (isMultiMap(headers)) { + const entries = headers.get(header); + return typeof entries === "string" ? entries : entries ? asArrayLike(entries).join(HEADER_SEPARATOR) : undefined; + } + if (isMap(headers)) { return headers.get(header); } - if (isIterable(headers)) { + if (isIterable>(headers)) { const arrayLikeHeaders = asArrayLike(headers); - return arrayLikeHeaders.find(x => asArrayLike(x).at(0) === header); + return arrayLikeHeaders.find(x => asArrayLike(x).at(0) === header)?.[1]; } return headers[header];