@gopowerteam/request 0.1.17 → 0.1.18

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/dist/index.cjs CHANGED
@@ -175,12 +175,13 @@ var _RequestService = class {
175
175
  * @param {RequestPlugin[]} plugins 请求插件
176
176
  * @returns
177
177
  */
178
- async send(options, plugins = []) {
178
+ async send(options, requestPlugins = []) {
179
179
  if (!_RequestService.config) {
180
180
  throw new Error("\u8BF7\u68C0\u67E5\u8BF7\u6C42\u914D\u7F6E\u662F\u5426\u5B8C\u6210");
181
181
  }
182
182
  let hasException = false;
183
183
  const adapter = this.getRequestAdapter();
184
+ const plugins = requestPlugins.filter(Boolean);
184
185
  const extraParams = await this.execRequestPlugin(plugins, options);
185
186
  const response = await this.startRequest(adapter, options, extraParams).then((response2) => adapter.transformResponse(response2)).catch((exception) => {
186
187
  hasException = true;
package/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ declare class RequestService {
49
49
  * @param {RequestPlugin[]} plugins 请求插件
50
50
  * @returns
51
51
  */
52
- send(options: RequestSendOptions, plugins?: RequestPlugin[]): Promise<any>;
52
+ send(options: RequestSendOptions, requestPlugins?: (RequestPlugin | undefined)[]): Promise<any>;
53
53
  /**
54
54
  * 生成请求路径
55
55
  * @param {RequestSendOptions} options 请求选项
package/dist/index.js CHANGED
@@ -134,12 +134,13 @@ var _RequestService = class {
134
134
  * @param {RequestPlugin[]} plugins 请求插件
135
135
  * @returns
136
136
  */
137
- async send(options, plugins = []) {
137
+ async send(options, requestPlugins = []) {
138
138
  if (!_RequestService.config) {
139
139
  throw new Error("\u8BF7\u68C0\u67E5\u8BF7\u6C42\u914D\u7F6E\u662F\u5426\u5B8C\u6210");
140
140
  }
141
141
  let hasException = false;
142
142
  const adapter = this.getRequestAdapter();
143
+ const plugins = requestPlugins.filter(Boolean);
143
144
  const extraParams = await this.execRequestPlugin(plugins, options);
144
145
  const response = await this.startRequest(adapter, options, extraParams).then((response2) => adapter.transformResponse(response2)).catch((exception) => {
145
146
  hasException = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/request",
3
3
  "private": false,
4
- "version": "0.1.17",
4
+ "version": "0.1.18",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",