@faasjs/http 0.0.2-beta.383 → 0.0.2-beta.386
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 +10 -16
- package/dist/index.mjs +2 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -19,24 +19,19 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
21
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
23
22
|
var __export = (target, all) => {
|
|
24
23
|
for (var name in all)
|
|
25
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
25
|
};
|
|
27
|
-
var
|
|
28
|
-
if (
|
|
29
|
-
for (let key of __getOwnPropNames(
|
|
30
|
-
if (!__hasOwnProp.call(
|
|
31
|
-
__defProp(
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
31
|
}
|
|
33
|
-
return
|
|
32
|
+
return to;
|
|
34
33
|
};
|
|
35
|
-
var __toCommonJS =
|
|
36
|
-
return (module2, temp) => {
|
|
37
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
38
|
-
};
|
|
39
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
35
|
|
|
41
36
|
// src/index.ts
|
|
42
37
|
var src_exports = {};
|
|
@@ -49,6 +44,7 @@ __export(src_exports, {
|
|
|
49
44
|
Validator: () => Validator,
|
|
50
45
|
useHttp: () => useHttp
|
|
51
46
|
});
|
|
47
|
+
module.exports = __toCommonJS(src_exports);
|
|
52
48
|
var import_func = require("@faasjs/func");
|
|
53
49
|
|
|
54
50
|
// ../deep_merge/src/index.ts
|
|
@@ -327,7 +323,6 @@ var Validator = class {
|
|
|
327
323
|
}
|
|
328
324
|
if (rule.regexp && (rule.type === "string" || !rule.type) && !rule.regexp.test(value)) {
|
|
329
325
|
const error = Error(`[${type}] ${baseKey}${key} must match ${rule.regexp}.`);
|
|
330
|
-
console.log("--------->22222");
|
|
331
326
|
if (config.onError) {
|
|
332
327
|
const res = config.onError(`${type}.rule.regexp`, `${baseKey}${key}`, value);
|
|
333
328
|
if (res)
|
|
@@ -500,7 +495,7 @@ var Http = class {
|
|
|
500
495
|
"Content-Type": "application/json; charset=utf-8",
|
|
501
496
|
"Cache-Control": "no-cache, no-store"
|
|
502
497
|
}, this.cookie.headers(), this.response.headers);
|
|
503
|
-
data.response = this.response;
|
|
498
|
+
data.response = __spreadValues(__spreadValues({}, data.response), this.response);
|
|
504
499
|
if (process.env.FaasMode === "local") {
|
|
505
500
|
this.logger.debug("[onInvoke] Response: %j", data.response);
|
|
506
501
|
return;
|
|
@@ -511,6 +506,7 @@ var Http = class {
|
|
|
511
506
|
if (!acceptEncoding || !/(br|gzip|deflate)/.test(acceptEncoding))
|
|
512
507
|
return;
|
|
513
508
|
const originBody = data.response.body;
|
|
509
|
+
data.response.originBody = originBody;
|
|
514
510
|
try {
|
|
515
511
|
if (acceptEncoding.includes("br")) {
|
|
516
512
|
data.response.headers["Content-Encoding"] = "br";
|
|
@@ -524,7 +520,6 @@ var Http = class {
|
|
|
524
520
|
} else
|
|
525
521
|
throw Error("No matched compression.");
|
|
526
522
|
data.response.isBase64Encoded = true;
|
|
527
|
-
data.response.originBody = originBody;
|
|
528
523
|
} catch (error) {
|
|
529
524
|
console.error(error);
|
|
530
525
|
data.response.body = originBody;
|
|
@@ -554,7 +549,6 @@ var Http = class {
|
|
|
554
549
|
function useHttp(config) {
|
|
555
550
|
return (0, import_func.usePlugin)(new Http(config));
|
|
556
551
|
}
|
|
557
|
-
module.exports = __toCommonJS(src_exports);
|
|
558
552
|
// Annotate the CommonJS export names for ESM import in node:
|
|
559
553
|
0 && (module.exports = {
|
|
560
554
|
ContentType,
|
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,7 @@ 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 = __spreadValues(__spreadValues({}, data.response), this.response);
|
|
493
492
|
if (process.env.FaasMode === "local") {
|
|
494
493
|
this.logger.debug("[onInvoke] Response: %j", data.response);
|
|
495
494
|
return;
|
|
@@ -500,6 +499,7 @@ var Http = class {
|
|
|
500
499
|
if (!acceptEncoding || !/(br|gzip|deflate)/.test(acceptEncoding))
|
|
501
500
|
return;
|
|
502
501
|
const originBody = data.response.body;
|
|
502
|
+
data.response.originBody = originBody;
|
|
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.386",
|
|
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.386",
|
|
26
|
+
"@faasjs/logger": "^0.0.2-beta.386"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsup": "*",
|