@less-is-more/less-js 1.4.26-0 → 1.4.26-2
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/package.json +1 -1
- package/src/router.js +5 -3
package/package.json
CHANGED
package/src/router.js
CHANGED
|
@@ -19,6 +19,8 @@ module.exports = class Router {
|
|
|
19
19
|
static async route(targets, req, res, context) {
|
|
20
20
|
const startTime = new Date().getTime();
|
|
21
21
|
const { methodName, className } = this._getPath(req);
|
|
22
|
+
// 兼容非阿里云
|
|
23
|
+
await this._handleParams(req);
|
|
22
24
|
console.log(
|
|
23
25
|
"p:",
|
|
24
26
|
req.method,
|
|
@@ -27,14 +29,12 @@ module.exports = class Router {
|
|
|
27
29
|
"q:",
|
|
28
30
|
req.queries ? JSON.stringify(req.queries).substring(0, 500) : "",
|
|
29
31
|
"b:",
|
|
30
|
-
req.
|
|
32
|
+
req.sourceBody ? req.sourceBody.substring(0, 500) : "",
|
|
31
33
|
req.files ? "f:" : "",
|
|
32
34
|
req.files ? req.params : "",
|
|
33
35
|
req.files ? req.files : ""
|
|
34
36
|
);
|
|
35
37
|
|
|
36
|
-
// 兼容非阿里云
|
|
37
|
-
await this._handleParams(req);
|
|
38
38
|
if (methodName) {
|
|
39
39
|
const controller = targets[className];
|
|
40
40
|
if (controller == undefined) {
|
|
@@ -106,6 +106,7 @@ module.exports = class Router {
|
|
|
106
106
|
const data = await promisify(body)(req);
|
|
107
107
|
if (!Param.isBlank(data)) {
|
|
108
108
|
try {
|
|
109
|
+
req.sourceBody = data;
|
|
109
110
|
req.body = JSON.parse(data);
|
|
110
111
|
} catch (e) {
|
|
111
112
|
console.warn("body格式错误", data);
|
|
@@ -113,6 +114,7 @@ module.exports = class Router {
|
|
|
113
114
|
}
|
|
114
115
|
} else {
|
|
115
116
|
const data = await promisify(body)(req);
|
|
117
|
+
req.sourceBody = data;
|
|
116
118
|
req.body = qs.parse(data);
|
|
117
119
|
}
|
|
118
120
|
}
|