@wiajs/req 1.7.15 → 1.7.16
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/node/req.cjs +6 -7
- package/dist/req.js +1 -1
- package/dist/req.min.js +1 -1
- package/dist/web/req.cjs +1 -1
- package/dist/web/req.mjs +1 -1
- package/lib/adapters/http.js +7 -7
- package/lib/index.js +6 -0
- package/package.json +1 -1
package/dist/node/req.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
2
|
+
* @wia/req v1.7.16
|
|
3
3
|
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -2908,17 +2908,18 @@ class HttpAdapter {
|
|
|
2908
2908
|
path,
|
|
2909
2909
|
method,
|
|
2910
2910
|
headers: headers.toJSON(),
|
|
2911
|
-
// agents: {http: config.httpAgent, https: config.httpsAgent},
|
|
2912
|
-
agents,
|
|
2913
2911
|
auth,
|
|
2914
2912
|
protocol,
|
|
2915
2913
|
family,
|
|
2916
2914
|
beforeRedirect: dispatchBeforeRedirect,
|
|
2917
2915
|
beforeRedirects: {},
|
|
2918
|
-
http,
|
|
2919
|
-
https,
|
|
2920
2916
|
};
|
|
2921
2917
|
|
|
2918
|
+
if (config.httpAgent) options.agents = {http: config.httpAgent};
|
|
2919
|
+
if (config.httpsAgent) options.agents.https = config.httpAgent;
|
|
2920
|
+
// ! 配置了 agent,使用Agent,否则使用缺省 agent
|
|
2921
|
+
if (config.agent) options.agents = new agent.Agent(config.agent);
|
|
2922
|
+
|
|
2922
2923
|
// cacheable-lookup integration hotfix
|
|
2923
2924
|
if (!utils$1.isUndefined(lookup)) options.lookup = lookup;
|
|
2924
2925
|
|
|
@@ -2928,8 +2929,6 @@ class HttpAdapter {
|
|
|
2928
2929
|
? parsed.hostname.slice(1, -1)
|
|
2929
2930
|
: parsed.hostname;
|
|
2930
2931
|
options.port = parsed.port;
|
|
2931
|
-
// ! proxy 配置了 agent,否则使用缺省 agent
|
|
2932
|
-
if (config.agent) options.agents = new agent.Agent(config.agent);
|
|
2933
2932
|
}
|
|
2934
2933
|
|
|
2935
2934
|
// 执行请求的具体对象
|
package/dist/req.js
CHANGED
package/dist/req.min.js
CHANGED
package/dist/web/req.cjs
CHANGED
package/dist/web/req.mjs
CHANGED
package/lib/adapters/http.js
CHANGED
|
@@ -262,24 +262,24 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
|
|
|
262
262
|
path,
|
|
263
263
|
method,
|
|
264
264
|
headers: headers.toJSON(),
|
|
265
|
-
// agents: {http: config.httpAgent, https: config.httpsAgent},
|
|
266
|
-
agents,
|
|
267
265
|
auth,
|
|
268
266
|
protocol,
|
|
269
267
|
family,
|
|
270
268
|
beforeRedirect: dispatchBeforeRedirect,
|
|
271
|
-
beforeRedirects: {}
|
|
272
|
-
http,
|
|
273
|
-
https
|
|
269
|
+
beforeRedirects: {}
|
|
274
270
|
};
|
|
271
|
+
if (config.httpAgent) options.agents = {
|
|
272
|
+
http: config.httpAgent
|
|
273
|
+
};
|
|
274
|
+
if (config.httpsAgent) options.agents.https = config.httpAgent;
|
|
275
|
+
// ! 配置了 agent,使用Agent,否则使用缺省 agent
|
|
276
|
+
if (config.agent) options.agents = new Agent(config.agent);
|
|
275
277
|
// cacheable-lookup integration hotfix
|
|
276
278
|
if (!utils.isUndefined(lookup)) options.lookup = lookup;
|
|
277
279
|
if (config.socketPath) options.socketPath = config.socketPath;
|
|
278
280
|
else {
|
|
279
281
|
options.hostname = parsed.hostname.startsWith('[') ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
280
282
|
options.port = parsed.port;
|
|
281
|
-
// ! proxy 配置了 agent,否则使用缺省 agent
|
|
282
|
-
if (config.agent) options.agents = new Agent(config.agent);
|
|
283
283
|
}
|
|
284
284
|
// 执行请求的具体对象
|
|
285
285
|
_.transport = config.transport;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import req from './req.js';
|
|
2
|
+
// This module is intended to unwrap Axios default export as named.
|
|
3
|
+
// Keep top-level export same with static properties
|
|
4
|
+
// so that it can keep same with es module or cjs
|
|
5
|
+
const { Axios, AxiosError, CanceledError, isCancel, CancelToken, VERSION, all, Cancel, isAxiosError, spread, toFormData, AxiosHeaders, HttpStatusCode, formToJSON, getAdapter, mergeConfig } = req;
|
|
6
|
+
export { req as default, Axios, AxiosError, CanceledError, isCancel, CancelToken, VERSION, all, Cancel, isAxiosError, spread, toFormData, AxiosHeaders, HttpStatusCode, formToJSON, getAdapter, mergeConfig, };
|