@faasjs/http 0.0.3-beta.103 → 0.0.3-beta.105

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/dist/index.js CHANGED
@@ -370,6 +370,21 @@ var HttpError = class _HttpError extends Error {
370
370
  }
371
371
  };
372
372
  var Name = "http";
373
+ function deepClone(obj) {
374
+ if (obj === null || typeof obj !== "object" || Array.isArray(obj))
375
+ return JSON.parse(JSON.stringify(obj));
376
+ const clone = {};
377
+ for (const key in obj) {
378
+ if (!obj.hasOwnProperty(key))
379
+ continue;
380
+ if (typeof obj[key] === "function") {
381
+ clone[key] = obj[key].bind(clone);
382
+ continue;
383
+ }
384
+ clone[key] = deepClone(obj[key]);
385
+ }
386
+ return clone;
387
+ }
373
388
  var Http = class {
374
389
  constructor(config) {
375
390
  this.type = Name;
@@ -452,7 +467,7 @@ var Http = class {
452
467
  }
453
468
  if (this.params && typeof this.params === "object" && this.params["_"])
454
469
  delete this.params["_"];
455
- data.event.params = JSON.parse(JSON.stringify(this.params));
470
+ data.event.params = deepClone(this.params);
456
471
  data.logger.debug("[onInvoke] Params: %j", this.params);
457
472
  }
458
473
  this.cookie.invoke(this.headers.cookie, data.logger);
package/dist/index.mjs CHANGED
@@ -368,6 +368,21 @@ var HttpError = class _HttpError extends Error {
368
368
  }
369
369
  };
370
370
  var Name = "http";
371
+ function deepClone(obj) {
372
+ if (obj === null || typeof obj !== "object" || Array.isArray(obj))
373
+ return JSON.parse(JSON.stringify(obj));
374
+ const clone = {};
375
+ for (const key in obj) {
376
+ if (!obj.hasOwnProperty(key))
377
+ continue;
378
+ if (typeof obj[key] === "function") {
379
+ clone[key] = obj[key].bind(clone);
380
+ continue;
381
+ }
382
+ clone[key] = deepClone(obj[key]);
383
+ }
384
+ return clone;
385
+ }
371
386
  var Http = class {
372
387
  constructor(config) {
373
388
  this.type = Name;
@@ -450,7 +465,7 @@ var Http = class {
450
465
  }
451
466
  if (this.params && typeof this.params === "object" && this.params["_"])
452
467
  delete this.params["_"];
453
- data.event.params = JSON.parse(JSON.stringify(this.params));
468
+ data.event.params = deepClone(this.params);
454
469
  data.logger.debug("[onInvoke] Params: %j", this.params);
455
470
  }
456
471
  this.cookie.invoke(this.headers.cookie, data.logger);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/http",
3
- "version": "0.0.3-beta.103",
3
+ "version": "0.0.3-beta.105",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,8 +22,8 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@faasjs/func": "0.0.3-beta.103",
26
- "@faasjs/logger": "0.0.3-beta.103"
25
+ "@faasjs/func": "0.0.3-beta.105",
26
+ "@faasjs/logger": "0.0.3-beta.105"
27
27
  },
28
28
  "engines": {
29
29
  "npm": ">=8.0.0",