@less-is-more/less-js 1.4.25 → 1.4.26-0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/router.js +14 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@less-is-more/less-js",
3
- "version": "1.4.25",
3
+ "version": "1.4.26-0",
4
4
  "description": "Fast develop kit for nodejs",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/router.js CHANGED
@@ -19,6 +19,20 @@ 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
+ console.log(
23
+ "p:",
24
+ req.method,
25
+ req.path,
26
+ req.headers ? req.headers["content-type"] : "",
27
+ "q:",
28
+ req.queries ? JSON.stringify(req.queries).substring(0, 500) : "",
29
+ "b:",
30
+ req.body ? JSON.stringify(req.body).substring(0, 500) : "",
31
+ req.files ? "f:" : "",
32
+ req.files ? req.params : "",
33
+ req.files ? req.files : ""
34
+ );
35
+
22
36
  // 兼容非阿里云
23
37
  await this._handleParams(req);
24
38
  if (methodName) {
@@ -67,7 +81,6 @@ module.exports = class Router {
67
81
  }
68
82
 
69
83
  static _getPath(req) {
70
- console.log("path:", req.method, req.path, req.headers["content-type"]);
71
84
  const paths = req.path.split("/");
72
85
  const className = paths.length > 2 ? "/" + paths[paths.length - 2] : "/";
73
86
  const methodName = paths[paths.length - 1];
@@ -78,10 +91,6 @@ module.exports = class Router {
78
91
  if (req.query) {
79
92
  req.queries = req.query;
80
93
  }
81
- console.log(
82
- "queries:",
83
- req.queries ? JSON.stringify(req.queries).substring(0, 500) : ""
84
- );
85
94
  const isFile =
86
95
  req.headers &&
87
96
  req.headers["content-type"] &&
@@ -90,15 +99,11 @@ module.exports = class Router {
90
99
  req.headers &&
91
100
  req.headers["content-type"] &&
92
101
  req.headers["content-type"].includes("application/json");
93
- console.log("multipart:", isFile);
94
102
  if (req.method == "POST") {
95
103
  if (isFile) {
96
104
  await this._getFile(req);
97
- console.log("params:", req.params);
98
- console.log("files:", req.files);
99
105
  } else if (isJson) {
100
106
  const data = await promisify(body)(req);
101
- console.log("body: " + data);
102
107
  if (!Param.isBlank(data)) {
103
108
  try {
104
109
  req.body = JSON.parse(data);
@@ -108,7 +113,6 @@ module.exports = class Router {
108
113
  }
109
114
  } else {
110
115
  const data = await promisify(body)(req);
111
- console.log("body: " + data.substring(0, 500));
112
116
  req.body = qs.parse(data);
113
117
  }
114
118
  }