braid-http 1.3.3 → 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.
@@ -141,7 +141,7 @@ if (is_nodejs) {
141
141
  }
142
142
 
143
143
  async function braid_fetch (url, params = {}) {
144
- params = {...params} // Copy params, because we'll mutate it
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
  // ****************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-http",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "An implementation of Braid-HTTP for Node.js and Browsers",
5
5
  "scripts": {
6
6
  "test": "node test/server.js"