@wiajs/req 1.7.16 → 1.7.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/node/req.cjs +11 -11
- 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 +10 -14
- package/package.json +3 -3
package/dist/node/req.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
2
|
+
* @wia/req v1.7.18
|
|
3
3
|
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -2955,7 +2955,7 @@ class HttpAdapter {
|
|
|
2955
2955
|
_.options = options;
|
|
2956
2956
|
_.data = data;
|
|
2957
2957
|
|
|
2958
|
-
log({config}, 'init')
|
|
2958
|
+
// log({config}, 'init')
|
|
2959
2959
|
return options
|
|
2960
2960
|
}
|
|
2961
2961
|
|
|
@@ -3044,7 +3044,7 @@ class HttpAdapter {
|
|
|
3044
3044
|
_.req = req;
|
|
3045
3045
|
|
|
3046
3046
|
emitter.once('abort', err => {
|
|
3047
|
-
log('onabort')
|
|
3047
|
+
// log('onabort')
|
|
3048
3048
|
reject(err);
|
|
3049
3049
|
req.destroy(err);
|
|
3050
3050
|
});
|
|
@@ -3053,7 +3053,7 @@ class HttpAdapter {
|
|
|
3053
3053
|
req.on(
|
|
3054
3054
|
'error',
|
|
3055
3055
|
/** @param {*} err */ err => {
|
|
3056
|
-
log('onerror')
|
|
3056
|
+
// log('onerror')
|
|
3057
3057
|
// @todo remove
|
|
3058
3058
|
// if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
|
|
3059
3059
|
reject(AxiosError.from(err, null, config, req));
|
|
@@ -3064,7 +3064,7 @@ class HttpAdapter {
|
|
|
3064
3064
|
req.on(
|
|
3065
3065
|
'socket',
|
|
3066
3066
|
/** @param {*} socket */ socket => {
|
|
3067
|
-
log('onsocket')
|
|
3067
|
+
// log('onsocket')
|
|
3068
3068
|
// default interval of sending ack packet is 1 minute
|
|
3069
3069
|
socket.setKeepAlive(true, 1000 * 60);
|
|
3070
3070
|
}
|
|
@@ -3134,11 +3134,11 @@ class HttpAdapter {
|
|
|
3134
3134
|
// 'transfer-encoding': 'chunked'时,无content-length,axios v1.2 不能自动解压
|
|
3135
3135
|
const responseLength = +res.headers['content-length'];
|
|
3136
3136
|
|
|
3137
|
-
log('onresponse', {
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
})
|
|
3137
|
+
// log('onresponse', {
|
|
3138
|
+
// statusCode: res.statusCode,
|
|
3139
|
+
// responseLength,
|
|
3140
|
+
// headers: res.headers,
|
|
3141
|
+
// })
|
|
3142
3142
|
|
|
3143
3143
|
// return the last request(ClientRequest) in case of redirects
|
|
3144
3144
|
const lastRequest = res.req || req;
|
|
@@ -3300,7 +3300,7 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
3300
3300
|
*
|
|
3301
3301
|
*/
|
|
3302
3302
|
function dispatchBeforeRedirect(options, responseDetails) {
|
|
3303
|
-
log.debug('dispatchBeforeRedirect', {opts: options.beforeRedirects})
|
|
3303
|
+
// log.debug('dispatchBeforeRedirect', {opts: options.beforeRedirects})
|
|
3304
3304
|
|
|
3305
3305
|
if (options.beforeRedirects.proxy) options.beforeRedirects.proxy(options);
|
|
3306
3306
|
if (options.beforeRedirects.config) options.beforeRedirects.config(options, responseDetails);
|
package/dist/req.js
CHANGED
package/dist/req.min.js
CHANGED
package/dist/web/req.cjs
CHANGED
package/dist/web/req.mjs
CHANGED