@modern-js/create-request 2.68.17 → 2.68.18
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/cjs/browser.js +3 -3
- package/dist/cjs/node.js +3 -3
- package/dist/cjs/qs.js +30 -0
- package/dist/esm/browser.js +1 -1
- package/dist/esm/node.js +1 -1
- package/dist/esm/qs.js +5 -0
- package/dist/esm-node/browser.js +1 -1
- package/dist/esm-node/node.js +1 -1
- package/dist/esm-node/qs.js +5 -0
- package/dist/types/qs.d.ts +1 -0
- package/package.json +14 -5
package/dist/cjs/browser.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(browser_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(browser_exports);
|
|
26
26
|
var import_path_to_regexp = require("path-to-regexp");
|
|
27
|
-
var
|
|
27
|
+
var import_qs = require("qs");
|
|
28
28
|
var import_handleRes = require("./handleRes");
|
|
29
29
|
var import_utiles = require("./utiles");
|
|
30
30
|
const realRequest = /* @__PURE__ */ new Map();
|
|
@@ -88,7 +88,7 @@ const createRequest = ({ path, method, port, httpMethodDecider = "functionName",
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
const finalPath = getFinalPath(payload.params);
|
|
91
|
-
finalURL = payload.query ? `${finalPath}?${(0,
|
|
91
|
+
finalURL = payload.query ? `${finalPath}?${(0, import_qs.stringify)(payload.query)}` : finalPath;
|
|
92
92
|
headers = payload.headers || {};
|
|
93
93
|
body = payload.data && typeof payload.data === "object" ? JSON.stringify(payload.data) : payload.body;
|
|
94
94
|
if (payload.data) {
|
|
@@ -103,7 +103,7 @@ const createRequest = ({ path, method, port, httpMethodDecider = "functionName",
|
|
|
103
103
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
104
104
|
if (typeof payload.formUrlencoded === "object" && // @ts-expect-error
|
|
105
105
|
!(payload.formUrlencoded instanceof URLSearchParams)) {
|
|
106
|
-
body = (0,
|
|
106
|
+
body = (0, import_qs.stringify)(payload.formUrlencoded);
|
|
107
107
|
} else {
|
|
108
108
|
body = payload.formUrlencoded;
|
|
109
109
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(node_exports);
|
|
|
36
36
|
var import_node = require("@modern-js/runtime-utils/node");
|
|
37
37
|
var import_node_fetch = __toESM(require("node-fetch"));
|
|
38
38
|
var import_path_to_regexp = require("path-to-regexp");
|
|
39
|
-
var
|
|
39
|
+
var import_qs = require("qs");
|
|
40
40
|
var import_handleRes = require("./handleRes");
|
|
41
41
|
var import_utiles = require("./utiles");
|
|
42
42
|
const realRequest = /* @__PURE__ */ new Map();
|
|
@@ -101,7 +101,7 @@ const createRequest = ({ path, method, port, httpMethodDecider = "functionName",
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
const plainPath = getFinalPath(payload.params);
|
|
104
|
-
const finalPath = payload.query ? `${plainPath}?${(0,
|
|
104
|
+
const finalPath = payload.query ? `${plainPath}?${(0, import_qs.stringify)(payload.query)}` : plainPath;
|
|
105
105
|
headers = payload.headers || {};
|
|
106
106
|
const targetAllowedHeaders = realAllowedHeaders.get(requestId) || [];
|
|
107
107
|
for (const key of targetAllowedHeaders) {
|
|
@@ -120,7 +120,7 @@ const createRequest = ({ path, method, port, httpMethodDecider = "functionName",
|
|
|
120
120
|
} else if (payload.formUrlencoded) {
|
|
121
121
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
122
122
|
if (typeof payload.formUrlencoded === "object") {
|
|
123
|
-
body = (0,
|
|
123
|
+
body = (0, import_qs.stringify)(payload.formUrlencoded);
|
|
124
124
|
} else {
|
|
125
125
|
body = payload.formUrlencoded;
|
|
126
126
|
}
|
package/dist/cjs/qs.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var qs_exports = {};
|
|
20
|
+
__export(qs_exports, {
|
|
21
|
+
parse: () => import_qs.parse,
|
|
22
|
+
stringify: () => import_qs.stringify
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(qs_exports);
|
|
25
|
+
var import_qs = require("qs");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
parse,
|
|
29
|
+
stringify
|
|
30
|
+
});
|
package/dist/esm/browser.js
CHANGED
|
@@ -4,7 +4,7 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
4
4
|
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
5
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
6
6
|
import { compile, pathToRegexp } from "path-to-regexp";
|
|
7
|
-
import { stringify } from "
|
|
7
|
+
import { stringify } from "qs";
|
|
8
8
|
import { handleRes } from "./handleRes";
|
|
9
9
|
import { getUploadPayload } from "./utiles";
|
|
10
10
|
var realRequest = /* @__PURE__ */ new Map();
|
package/dist/esm/node.js
CHANGED
|
@@ -4,7 +4,7 @@ import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
|
4
4
|
import { storage } from "@modern-js/runtime-utils/node";
|
|
5
5
|
import nodeFetch from "node-fetch";
|
|
6
6
|
import { compile, pathToRegexp } from "path-to-regexp";
|
|
7
|
-
import { stringify } from "
|
|
7
|
+
import { stringify } from "qs";
|
|
8
8
|
import { handleRes } from "./handleRes";
|
|
9
9
|
import { getUploadPayload } from "./utiles";
|
|
10
10
|
var realRequest = /* @__PURE__ */ new Map();
|
package/dist/esm/qs.js
ADDED
package/dist/esm-node/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compile, pathToRegexp } from "path-to-regexp";
|
|
2
|
-
import { stringify } from "
|
|
2
|
+
import { stringify } from "qs";
|
|
3
3
|
import { handleRes } from "./handleRes";
|
|
4
4
|
import { getUploadPayload } from "./utiles";
|
|
5
5
|
const realRequest = /* @__PURE__ */ new Map();
|
package/dist/esm-node/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { storage } from "@modern-js/runtime-utils/node";
|
|
2
2
|
import nodeFetch from "node-fetch";
|
|
3
3
|
import { compile, pathToRegexp } from "path-to-regexp";
|
|
4
|
-
import { stringify } from "
|
|
4
|
+
import { stringify } from "qs";
|
|
5
5
|
import { handleRes } from "./handleRes";
|
|
6
6
|
import { getUploadPayload } from "./utiles";
|
|
7
7
|
const realRequest = /* @__PURE__ */ new Map();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { stringify, parse } from 'qs';
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.68.
|
|
18
|
+
"version": "2.68.18",
|
|
19
19
|
"jsnext:source": "./src/node.ts",
|
|
20
20
|
"types": "./dist/types/browser.d.ts",
|
|
21
21
|
"main": "./dist/cjs/node.js",
|
|
@@ -54,6 +54,11 @@
|
|
|
54
54
|
"types": "./dist/types/node.d.ts",
|
|
55
55
|
"jsnext:source": "./src/node.ts",
|
|
56
56
|
"default": "./dist/cjs/node.js"
|
|
57
|
+
},
|
|
58
|
+
"./qs": {
|
|
59
|
+
"types": "./dist/types/qs.d.ts",
|
|
60
|
+
"jsnext:source": "./src/qs.ts",
|
|
61
|
+
"default": "./dist/cjs/qs.js"
|
|
57
62
|
}
|
|
58
63
|
},
|
|
59
64
|
"typesVersions": {
|
|
@@ -66,6 +71,9 @@
|
|
|
66
71
|
],
|
|
67
72
|
"server": [
|
|
68
73
|
"./dist/types/node.d.ts"
|
|
74
|
+
],
|
|
75
|
+
"qs": [
|
|
76
|
+
"./dist/types/qs.d.ts"
|
|
69
77
|
]
|
|
70
78
|
}
|
|
71
79
|
},
|
|
@@ -74,9 +82,9 @@
|
|
|
74
82
|
"encoding": "^0.1.13",
|
|
75
83
|
"node-fetch": "^2.7.0",
|
|
76
84
|
"path-to-regexp": "^6.3.0",
|
|
77
|
-
"
|
|
78
|
-
"@modern-js/runtime-utils": "2.68.
|
|
79
|
-
"@modern-js/utils": "2.68.
|
|
85
|
+
"qs": "^6.14.0",
|
|
86
|
+
"@modern-js/runtime-utils": "2.68.18",
|
|
87
|
+
"@modern-js/utils": "2.68.18"
|
|
80
88
|
},
|
|
81
89
|
"devDependencies": {
|
|
82
90
|
"@types/jest": "^29",
|
|
@@ -85,8 +93,9 @@
|
|
|
85
93
|
"isomorphic-fetch": "^3.0.0",
|
|
86
94
|
"jest": "^29",
|
|
87
95
|
"nock": "^13.5.6",
|
|
96
|
+
"@types/qs": "^6.14.0",
|
|
88
97
|
"typescript": "^5",
|
|
89
|
-
"@modern-js/types": "2.68.
|
|
98
|
+
"@modern-js/types": "2.68.18",
|
|
90
99
|
"@scripts/build": "2.66.0",
|
|
91
100
|
"@scripts/jest-config": "2.66.0"
|
|
92
101
|
},
|