@jayfong/x-server 1.34.4 → 1.34.5

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.
@@ -92,12 +92,12 @@ class Server {
92
92
 
93
93
  const routeMap = (0, _vtils.keyBy)(this.routes, item => item.path);
94
94
 
95
- const handleRoute = async (item, req, res) => {
95
+ const handleRoute = async (item, req, res, path) => {
96
96
  const handlerOptions = item.handler.options;
97
97
  const handlerMethod = handlerOptions.requestMethod || 'POST';
98
98
  const isWS = handlerMethod === 'WS';
99
99
  const url = `${appUrl}${// 结构:/test/sss?x=2
100
- isWS ? res.url : req.url}`;
100
+ path != null ? path : isWS ? res.url : req.url}`;
101
101
 
102
102
  if (isWS) {
103
103
  await item.handler.handle(undefined, {
@@ -178,7 +178,7 @@ class Server {
178
178
  throw new _http_error.HttpError.NotFound();
179
179
  }
180
180
 
181
- return handleRoute(routeMap[requestPath], req, res);
181
+ return handleRoute(routeMap[requestPath], req, res, requestPath);
182
182
  }
183
183
  });
184
184
  }
@@ -77,12 +77,12 @@ export class Server {
77
77
  const appUrl = x.env.APP_URL.replace(/\/+$/, '');
78
78
  const routeMap = keyBy(this.routes, item => item.path);
79
79
 
80
- const handleRoute = async (item, req, res) => {
80
+ const handleRoute = async (item, req, res, path) => {
81
81
  const handlerOptions = item.handler.options;
82
82
  const handlerMethod = handlerOptions.requestMethod || 'POST';
83
83
  const isWS = handlerMethod === 'WS';
84
84
  const url = `${appUrl}${// 结构:/test/sss?x=2
85
- isWS ? res.url : req.url}`;
85
+ path != null ? path : isWS ? res.url : req.url}`;
86
86
 
87
87
  if (isWS) {
88
88
  await item.handler.handle(undefined, {
@@ -163,7 +163,7 @@ export class Server {
163
163
  throw new HttpError.NotFound();
164
164
  }
165
165
 
166
- return handleRoute(routeMap[requestPath], req, res);
166
+ return handleRoute(routeMap[requestPath], req, res, requestPath);
167
167
  }
168
168
  });
169
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.34.4",
3
+ "version": "1.34.5",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",