@wiajs/req 1.7.22 → 1.7.23

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.22
2
+ * @wia/req v1.7.23
3
3
  * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -2952,8 +2952,9 @@ class HttpAdapter {
2952
2952
 
2953
2953
  if (config.insecureHTTPParser) options.insecureHTTPParser = config.insecureHTTPParser;
2954
2954
 
2955
+ // _.data = data
2956
+ options.data = data; // 传给 request 处理
2955
2957
  _.options = options;
2956
- _.data = data;
2957
2958
 
2958
2959
  // log({config}, 'init')
2959
2960
  return options
@@ -2975,7 +2976,7 @@ class HttpAdapter {
2975
2976
  try {
2976
2977
  await _.init();
2977
2978
 
2978
- const {transport, protocol, config, options, data, abort, emitter, maxDownloadRate} = _;
2979
+ const {transport, protocol, config, options, abort, emitter, maxDownloadRate} = _;
2979
2980
  const {responseType, responseEncoding, onDownloadProgress} = config;
2980
2981
 
2981
2982
  if (protocol === 'data:') {
@@ -3060,15 +3061,15 @@ class HttpAdapter {
3060
3061
  }
3061
3062
  );
3062
3063
 
3064
+ // socket 连接成功事件,移到 request
3063
3065
  // set tcp keep alive to prevent drop connection by peer
3064
- req.on(
3065
- 'socket',
3066
- /** @param {*} socket */ socket => {
3067
- // log('onsocket')
3068
- // default interval of sending ack packet is 1 minute
3069
- socket.setKeepAlive(true, 1000 * 60);
3070
- }
3071
- );
3066
+ // req.on(
3067
+ // 'socket',
3068
+ // /** @param {*} socket */ socket => {
3069
+ // // default interval of sending ack packet is 1 minute
3070
+ // socket.setKeepAlive(true, 1000 * 60)
3071
+ // }
3072
+ // )
3072
3073
 
3073
3074
  // Handle request timeout
3074
3075
  if (config.timeout) {
@@ -3237,7 +3238,7 @@ class HttpAdapter {
3237
3238
  }
3238
3239
  );
3239
3240
 
3240
- // 非stream模式需发送数据,由request处理
3241
+ // 非stream模式需发送数据,改由request处理
3241
3242
  // if (utils.isStream(data)) {
3242
3243
  // // Send the request
3243
3244
  // let ended = false
package/dist/req.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @wia/req v1.7.22
2
+ * @wia/req v1.7.23
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.22
2
+ * @wia/req v1.7.23
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.22
2
+ * @wia/req v1.7.23
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.22
2
+ * @wia/req v1.7.23
3
3
  * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -296,8 +296,10 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
296
296
  if (config.maxRedirects) options.maxRedirects = config.maxRedirects;
297
297
  if (config.beforeRedirect) options.beforeRedirects.config = config.beforeRedirect;
298
298
  if (config.insecureHTTPParser) options.insecureHTTPParser = config.insecureHTTPParser;
299
+ // _.data = data
300
+ options.data = data // 传给 request 处理
301
+ ;
299
302
  _.options = options;
300
- _.data = data;
301
303
  // log({config}, 'init')
302
304
  return options;
303
305
  }
@@ -313,7 +315,7 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
313
315
  const _ = this;
314
316
  try {
315
317
  await _.init();
316
- const { transport, protocol, config, options, data, abort, emitter, maxDownloadRate } = _;
318
+ const { transport, protocol, config, options, abort, emitter, maxDownloadRate } = _;
317
319
  const { responseType, responseEncoding, onDownloadProgress } = config;
318
320
  if (protocol === 'data:') {
319
321
  /** @type {*} */ let convertedData;
@@ -371,12 +373,15 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
371
373
  // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
372
374
  reject(AxiosError.from(err, null, config, req));
373
375
  });
376
+ // socket 连接成功事件,移到 request
374
377
  // set tcp keep alive to prevent drop connection by peer
375
- req.on('socket', /** @param {*} socket */ (socket)=>{
376
- // log('onsocket')
377
- // default interval of sending ack packet is 1 minute
378
- socket.setKeepAlive(true, 1000 * 60);
379
- });
378
+ // req.on(
379
+ // 'socket',
380
+ // /** @param {*} socket */ socket => {
381
+ // // default interval of sending ack packet is 1 minute
382
+ // socket.setKeepAlive(true, 1000 * 60)
383
+ // }
384
+ // )
380
385
  // Handle request timeout
381
386
  if (config.timeout) {
382
387
  // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
@@ -482,7 +487,7 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
482
487
  }
483
488
  });
484
489
  });
485
- // 非stream模式需发送数据,由request处理
490
+ // 非stream模式需发送数据,改由request处理
486
491
  // if (utils.isStream(data)) {
487
492
  // // Send the request
488
493
  // let ended = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiajs/req",
3
- "version": "1.7.22",
3
+ "version": "1.7.23",
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.29",
146
+ "@wiajs/request": "^3.0.30",
147
147
  "@wiajs/agent": "^1.0.21",
148
148
  "form-data": "^4.0.0",
149
149
  "proxy-from-env": "^1.1.0"