handle empty headers
This commit is contained in:
parent
504f76649b
commit
b44167b16b
|
@ -49,8 +49,8 @@ export const signedFetch = async (url: string, init: RequestInit, signedInit: Si
|
||||||
signedHeaders.push(["Signature", signature]);
|
signedHeaders.push(["Signature", signature]);
|
||||||
|
|
||||||
const newHeaders = new Headers();
|
const newHeaders = new Headers();
|
||||||
if (Array.isArray(init.headers)) {
|
if (Array.isArray(init.headers) || !init.headers) {
|
||||||
for (const header of init.headers) {
|
for (const header of (init.headers || [])) {
|
||||||
if (Array.isArray(header))
|
if (Array.isArray(header))
|
||||||
newHeaders.set(header[0], header[1]);
|
newHeaders.set(header[0], header[1]);
|
||||||
else throw "unsupported headers type"; // Lazy.
|
else throw "unsupported headers type"; // Lazy.
|
||||||
|
|
Loading…
Reference in New Issue