From e1bbb064a10d0b4bf5563e0a79396665d83935a1 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 4 Aug 2020 20:49:40 -0400 Subject: [PATCH] Do not mutate connection in fetchJson. --- packages/web/src.ts/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/src.ts/index.ts b/packages/web/src.ts/index.ts index d5330f9fa6..0445cbf378 100644 --- a/packages/web/src.ts/index.ts +++ b/packages/web/src.ts/index.ts @@ -313,7 +313,7 @@ export function fetchJson(connection: string | ConnectionInfo, json?: string, pr body = toUtf8Bytes(json); // Create a connection with the content-type set for JSON - const updated: ConnectionInfo = (typeof(connection) === "string") ? ({ url: connection }): connection; + const updated: ConnectionInfo = (typeof(connection) === "string") ? ({ url: connection }): shallowCopy(connection); if (updated.headers) { const hasContentType = (Object.keys(updated.headers).filter((k) => (k.toLowerCase() === "content-type")).length) !== 0; if (!hasContentType) {