braid-http 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/braid-http-client.js +8 -1
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -141,7 +141,7 @@ if (is_nodejs) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
async function braid_fetch (url, params = {}) {
|
|
144
|
-
params =
|
|
144
|
+
params = deep_copy(params) // Copy params, because we'll mutate it
|
|
145
145
|
|
|
146
146
|
// Initialize the headers object
|
|
147
147
|
if (!params.headers)
|
|
@@ -804,6 +804,13 @@ function get_binary_length(x) {
|
|
|
804
804
|
x instanceof Blob ? x.size : undefined
|
|
805
805
|
}
|
|
806
806
|
|
|
807
|
+
function deep_copy(x) {
|
|
808
|
+
if (x === null || typeof x !== 'object') return x
|
|
809
|
+
if (Array.isArray(x)) return x.map(x => deep_copy(x))
|
|
810
|
+
if (Object.prototype.toString.call(x) === '[object Object]') return Object.fromEntries(Object.entries(x).map(([k, x]) => [k, deep_copy(x)]))
|
|
811
|
+
return x
|
|
812
|
+
}
|
|
813
|
+
|
|
807
814
|
// ****************************
|
|
808
815
|
// Exports
|
|
809
816
|
// ****************************
|