@wiajs/req 1.7.15 → 1.7.17
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/index.d.cts +439 -312
- package/index.d.ts +436 -319
- package/lib/adapters/http.js +7 -7
- package/lib/index.js +6 -0
- package/package.json +2 -2
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, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiajs/req",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.17",
|
|
4
4
|
"description": "Promise And Stream based AXIOS client for the browser and node.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"dependencies": {
|
|
145
145
|
"@wiajs/log": "^4.3.19",
|
|
146
146
|
"@wiajs/request": "^3.0.20",
|
|
147
|
-
"@wiajs/agent": "^1.0.
|
|
147
|
+
"@wiajs/agent": "^1.0.21",
|
|
148
148
|
"form-data": "^4.0.0",
|
|
149
149
|
"proxy-from-env": "^1.1.0"
|
|
150
150
|
},
|