@wiajs/req 1.7.17 → 1.7.19

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @wia/req v1.7.17
2
+ * @wia/req v1.7.19
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
  }
@@ -3125,8 +3125,8 @@ class HttpAdapter {
3125
3125
  req.on(
3126
3126
  'response',
3127
3127
  /**
3128
- * @param {*} res
3129
- * @param {*} stream
3128
+ * @param {*} res 原数据流
3129
+ * @param {*} stream 解压等处理后的数据流
3130
3130
  */
3131
3131
  (res, stream) => {
3132
3132
  if (req.destroyed) return
@@ -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
- statusCode: res.statusCode,
3139
- responseLength,
3140
- headers: res.headers,
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @wia/req v1.7.17
2
+ * @wia/req v1.7.19
3
3
  * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/req.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @wia/req v1.7.17
2
+ * @wia/req v1.7.19
3
3
  * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/web/req.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @wia/req v1.7.17
2
+ * @wia/req v1.7.19
3
3
  * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/web/req.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @wia/req v1.7.17
2
+ * @wia/req v1.7.19
3
3
  * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -298,9 +298,7 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
298
298
  if (config.insecureHTTPParser) options.insecureHTTPParser = config.insecureHTTPParser;
299
299
  _.options = options;
300
300
  _.data = data;
301
- log({
302
- config
303
- }, 'init');
301
+ // log({config}, 'init')
304
302
  return options;
305
303
  }
306
304
  /**
@@ -362,20 +360,20 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
362
360
  if (!req) return reject(new AxiosError('Request failed.', AxiosError.ERR_BAD_REQUEST, config));
363
361
  _.req = req;
364
362
  emitter.once('abort', (err)=>{
365
- log('onabort');
363
+ // log('onabort')
366
364
  reject(err);
367
365
  req.destroy(err);
368
366
  });
369
367
  // Handle errors
370
368
  req.on('error', /** @param {*} err */ (err)=>{
371
- log('onerror');
369
+ // log('onerror')
372
370
  // @todo remove
373
371
  // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
374
372
  reject(AxiosError.from(err, null, config, req));
375
373
  });
376
374
  // set tcp keep alive to prevent drop connection by peer
377
375
  req.on('socket', /** @param {*} socket */ (socket)=>{
378
- log('onsocket');
376
+ // log('onsocket')
379
377
  // default interval of sending ack packet is 1 minute
380
378
  socket.setKeepAlive(true, 1000 * 60);
381
379
  });
@@ -410,17 +408,17 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
410
408
  else {
411
409
  // 非stream模式,等待响应数据,返回数据
412
410
  req.on('response', /**
413
- * @param {*} res
414
- * @param {*} stream
411
+ * @param {*} res 原数据流
412
+ * @param {*} stream 解压等处理后的数据流
415
413
  */ (res, stream)=>{
416
414
  if (req.destroyed) return;
417
415
  // 'transfer-encoding': 'chunked'时,无content-length,axios v1.2 不能自动解压
418
416
  const responseLength = +res.headers['content-length'];
419
- log('onresponse', {
420
- statusCode: res.statusCode,
421
- responseLength,
422
- headers: res.headers
423
- });
417
+ // log('onresponse', {
418
+ // statusCode: res.statusCode,
419
+ // responseLength,
420
+ // headers: res.headers,
421
+ // })
424
422
  // return the last request(ClientRequest) in case of redirects
425
423
  const lastRequest = res.req || req;
426
424
  /** @type {*} */ const response = {
@@ -545,9 +543,7 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
545
543
  * @param {*} responseDetails - The options object that was passed to the request.
546
544
  *
547
545
  */ function dispatchBeforeRedirect(options, responseDetails) {
548
- log.debug('dispatchBeforeRedirect', {
549
- opts: options.beforeRedirects
550
- });
546
+ // log.debug('dispatchBeforeRedirect', {opts: options.beforeRedirects})
551
547
  if (options.beforeRedirects.proxy) options.beforeRedirects.proxy(options);
552
548
  if (options.beforeRedirects.config) options.beforeRedirects.config(options, responseDetails);
553
549
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiajs/req",
3
- "version": "1.7.17",
3
+ "version": "1.7.19",
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",
@@ -143,7 +143,7 @@
143
143
  },
144
144
  "dependencies": {
145
145
  "@wiajs/log": "^4.3.19",
146
- "@wiajs/request": "^3.0.20",
146
+ "@wiajs/request": "^3.0.25",
147
147
  "@wiajs/agent": "^1.0.21",
148
148
  "form-data": "^4.0.0",
149
149
  "proxy-from-env": "^1.1.0"