Skip to content

Commit

Permalink
Do not mutate connection in fetchJson.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Aug 5, 2020
1 parent d38ebae commit e1bbb06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/web/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e1bbb06

Please sign in to comment.