@ekhein/http-request 2.0.0 → 2.0.1

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.
@@ -59,6 +59,7 @@ const axios_1 = __importDefault(require("axios"));
59
59
  const tldts_1 = __importDefault(require("tldts"));
60
60
  const cookie = __importStar(require("cookie"));
61
61
  const jsdom_1 = require("jsdom");
62
+ const path_to_regexp_1 = require("path-to-regexp");
62
63
  const tough_cookie_1 = require("tough-cookie");
63
64
  const common_1 = require("@nestjs/common");
64
65
  const async_retry_decorator_1 = require("@ekhein/async-retry-decorator");
@@ -172,11 +173,11 @@ class HttpRequest {
172
173
  this.instance.interceptors.request.use((request) => __awaiter(this, void 0, void 0, function* () {
173
174
  if (request.serviceType == 1) { }
174
175
  if (request.serviceType == 2) {
175
- const group = String(request.path).split("/").at(-2);
176
- const action = String(request.path).split("/").at(-1);
176
+ const group = (0, path_to_regexp_1.compile)(request.path)(request.params).split("/").at(-2);
177
+ const action = (0, path_to_regexp_1.compile)(request.path)(request.params).split("/").at(-1);
177
178
  const invoke_timeout = Number(request.timeout - 5e3);
178
- request.url = String("/business-demo/invoke");
179
179
  request.params = Object({ group, action, invoke_timeout });
180
+ request.url = String("/business-demo/invoke");
180
181
  }
181
182
  return request;
182
183
  }));
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@ekhein/http-request",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "author": "ekhein",
6
6
  "main": "./dist/index.js",
7
7
  "files": [
8
- "dist", "types"
8
+ "dist",
9
+ "types"
9
10
  ],
10
11
  "scripts": {
11
12
  "build": "tsc"
@@ -32,6 +33,7 @@
32
33
  "http-cookie-agent": "^7.0.2",
33
34
  "jsdom": "^25.0.1",
34
35
  "lodash": "^4.17.21",
36
+ "path-to-regexp": "^8.3.0",
35
37
  "proxy-agent": "^6.5.0",
36
38
  "tldjs": "^2.3.2",
37
39
  "tldts": "^7.0.16",