handle empty headers

This commit is contained in:
Moon Man 2023-12-27 11:27:55 -05:00
parent 504f76649b
commit b44167b16b
1 changed files with 2 additions and 2 deletions

View File

@ -49,8 +49,8 @@ export const signedFetch = async (url: string, init: RequestInit, signedInit: Si
signedHeaders.push(["Signature", signature]);
const newHeaders = new Headers();
if (Array.isArray(init.headers)) {
for (const header of init.headers) {
if (Array.isArray(init.headers) || !init.headers) {
for (const header of (init.headers || [])) {
if (Array.isArray(header))
newHeaders.set(header[0], header[1]);
else throw "unsupported headers type"; // Lazy.