@x-9lab/xlab 1.2.0 → 1.2.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.
@@ -0,0 +1,3 @@
1
+ import type Fetch from "node-fetch";
2
+ declare function getFetch(): Promise<typeof Fetch>;
3
+ export { getFetch };
@@ -16,9 +16,9 @@ _export(exports, {
16
16
  post: ()=>requestPost
17
17
  });
18
18
  const _utils = require("@x-drive/utils");
19
+ const _nodeFetchWarper = require("@x-drive/node-fetch-warper");
19
20
  const _resolveUri = /*#__PURE__*/ _interopRequireDefault(require("./resolve-uri"));
20
21
  const _common = require("../common");
21
- const _nodeFetch = /*#__PURE__*/ _interopRequireDefault(require("node-fetch"));
22
22
  function _interopRequireDefault(obj) {
23
23
  return obj && obj.__esModule ? obj : {
24
24
  default: obj
@@ -109,7 +109,8 @@ const DEF_CONFIG = {
109
109
  if (data) {
110
110
  options.body = data;
111
111
  }
112
- const resp = await (0, _nodeFetch.default)(url, options);
112
+ const fetch = await (0, _nodeFetchWarper.getFetch)();
113
+ const resp = await fetch(url, options);
113
114
  if (resp) {
114
115
  if ((0, _utils.isExecutable)(config.onResponse)) {
115
116
  await config.onResponse(resp);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-9lab/xlab",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "9lab 服务端模块",
5
5
  "versionDesc": "业务 api 文件夹支持接口级别通用中间件定义",
6
6
  "scripts": {
@@ -33,7 +33,8 @@
33
33
  "koa-router": "11.0.1",
34
34
  "http-proxy": "1.18.1",
35
35
  "koa-compress": "5.1.0",
36
- "@x-drive/utils": "1.1.23"
36
+ "@x-drive/utils": "1.1.23",
37
+ "@x-drive/node-fetch-warper": "1.0.1"
37
38
  },
38
39
  "devDependencies": {
39
40
  "co": "4.6.0",