@faasjs/http 0.0.2-beta.385 → 0.0.2-beta.388
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 +3 -4
- package/dist/index.mjs +3 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -323,7 +323,6 @@ var Validator = class {
|
|
|
323
323
|
}
|
|
324
324
|
if (rule.regexp && (rule.type === "string" || !rule.type) && !rule.regexp.test(value)) {
|
|
325
325
|
const error = Error(`[${type}] ${baseKey}${key} must match ${rule.regexp}.`);
|
|
326
|
-
console.log("--------->22222");
|
|
327
326
|
if (config.onError) {
|
|
328
327
|
const res = config.onError(`${type}.rule.regexp`, `${baseKey}${key}`, value);
|
|
329
328
|
if (res)
|
|
@@ -496,7 +495,9 @@ var Http = class {
|
|
|
496
495
|
"Content-Type": "application/json; charset=utf-8",
|
|
497
496
|
"Cache-Control": "no-cache, no-store"
|
|
498
497
|
}, this.cookie.headers(), this.response.headers);
|
|
499
|
-
data.response = this.response;
|
|
498
|
+
data.response = Object.assign(data.response, this.response);
|
|
499
|
+
const originBody = data.response.body;
|
|
500
|
+
data.response.originBody = originBody;
|
|
500
501
|
if (process.env.FaasMode === "local") {
|
|
501
502
|
this.logger.debug("[onInvoke] Response: %j", data.response);
|
|
502
503
|
return;
|
|
@@ -506,7 +507,6 @@ var Http = class {
|
|
|
506
507
|
const acceptEncoding = this.headers["accept-encoding"] || this.headers["Accept-Encoding"];
|
|
507
508
|
if (!acceptEncoding || !/(br|gzip|deflate)/.test(acceptEncoding))
|
|
508
509
|
return;
|
|
509
|
-
const originBody = data.response.body;
|
|
510
510
|
try {
|
|
511
511
|
if (acceptEncoding.includes("br")) {
|
|
512
512
|
data.response.headers["Content-Encoding"] = "br";
|
|
@@ -520,7 +520,6 @@ var Http = class {
|
|
|
520
520
|
} else
|
|
521
521
|
throw Error("No matched compression.");
|
|
522
522
|
data.response.isBase64Encoded = true;
|
|
523
|
-
data.response.originBody = originBody;
|
|
524
523
|
} catch (error) {
|
|
525
524
|
console.error(error);
|
|
526
525
|
data.response.body = originBody;
|
package/dist/index.mjs
CHANGED
|
@@ -312,7 +312,6 @@ var Validator = class {
|
|
|
312
312
|
}
|
|
313
313
|
if (rule.regexp && (rule.type === "string" || !rule.type) && !rule.regexp.test(value)) {
|
|
314
314
|
const error = Error(`[${type}] ${baseKey}${key} must match ${rule.regexp}.`);
|
|
315
|
-
console.log("--------->22222");
|
|
316
315
|
if (config.onError) {
|
|
317
316
|
const res = config.onError(`${type}.rule.regexp`, `${baseKey}${key}`, value);
|
|
318
317
|
if (res)
|
|
@@ -489,7 +488,9 @@ var Http = class {
|
|
|
489
488
|
"Content-Type": "application/json; charset=utf-8",
|
|
490
489
|
"Cache-Control": "no-cache, no-store"
|
|
491
490
|
}, this.cookie.headers(), this.response.headers);
|
|
492
|
-
data.response = this.response;
|
|
491
|
+
data.response = Object.assign(data.response, this.response);
|
|
492
|
+
const originBody = data.response.body;
|
|
493
|
+
data.response.originBody = originBody;
|
|
493
494
|
if (process.env.FaasMode === "local") {
|
|
494
495
|
this.logger.debug("[onInvoke] Response: %j", data.response);
|
|
495
496
|
return;
|
|
@@ -499,7 +500,6 @@ var Http = class {
|
|
|
499
500
|
const acceptEncoding = this.headers["accept-encoding"] || this.headers["Accept-Encoding"];
|
|
500
501
|
if (!acceptEncoding || !/(br|gzip|deflate)/.test(acceptEncoding))
|
|
501
502
|
return;
|
|
502
|
-
const originBody = data.response.body;
|
|
503
503
|
try {
|
|
504
504
|
if (acceptEncoding.includes("br")) {
|
|
505
505
|
data.response.headers["Content-Encoding"] = "br";
|
|
@@ -513,7 +513,6 @@ var Http = class {
|
|
|
513
513
|
} else
|
|
514
514
|
throw Error("No matched compression.");
|
|
515
515
|
data.response.isBase64Encoded = true;
|
|
516
|
-
data.response.originBody = originBody;
|
|
517
516
|
} catch (error) {
|
|
518
517
|
console.error(error);
|
|
519
518
|
data.response.body = originBody;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/http",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.388",
|
|
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
|
"peerDependencies": {
|
|
25
|
-
"@faasjs/func": "^0.0.2-beta.
|
|
26
|
-
"@faasjs/logger": "^0.0.2-beta.
|
|
25
|
+
"@faasjs/func": "^0.0.2-beta.388",
|
|
26
|
+
"@faasjs/logger": "^0.0.2-beta.388"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsup": "*",
|