@wiajs/req 1.7.18 → 1.7.20
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 +29 -29
- 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 +24 -22
- package/package.json +2 -2
package/dist/node/req.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
2
|
+
* @wia/req v1.7.20
|
|
3
3
|
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -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
|
|
@@ -3237,32 +3237,32 @@ class HttpAdapter {
|
|
|
3237
3237
|
}
|
|
3238
3238
|
);
|
|
3239
3239
|
|
|
3240
|
-
//
|
|
3241
|
-
if (utils
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
} else req.end(data)
|
|
3240
|
+
// 非stream模式需发送数据,由request处理
|
|
3241
|
+
// if (utils.isStream(data)) {
|
|
3242
|
+
// // Send the request
|
|
3243
|
+
// let ended = false
|
|
3244
|
+
// let errored = false
|
|
3245
|
+
|
|
3246
|
+
// data.on('end', () => {
|
|
3247
|
+
// ended = true
|
|
3248
|
+
// })
|
|
3249
|
+
|
|
3250
|
+
// data.once(
|
|
3251
|
+
// 'error',
|
|
3252
|
+
// /** @param {*} err */ err => {
|
|
3253
|
+
// errored = true
|
|
3254
|
+
// req.destroy(err)
|
|
3255
|
+
// }
|
|
3256
|
+
// )
|
|
3257
|
+
|
|
3258
|
+
// data.on('close', () => {
|
|
3259
|
+
// if (!ended && !errored) {
|
|
3260
|
+
// abort(new CanceledError('Request stream has been aborted', config, req))
|
|
3261
|
+
// }
|
|
3262
|
+
// })
|
|
3263
|
+
|
|
3264
|
+
// data.pipe(req) // stream 写入数据
|
|
3265
|
+
// } else req.end(data)
|
|
3266
3266
|
}
|
|
3267
3267
|
});
|
|
3268
3268
|
}
|
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
|
@@ -408,8 +408,8 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
|
|
|
408
408
|
else {
|
|
409
409
|
// 非stream模式,等待响应数据,返回数据
|
|
410
410
|
req.on('response', /**
|
|
411
|
-
* @param {*} res
|
|
412
|
-
* @param {*} stream
|
|
411
|
+
* @param {*} res 原数据流
|
|
412
|
+
* @param {*} stream 解压等处理后的数据流
|
|
413
413
|
*/ (res, stream)=>{
|
|
414
414
|
if (req.destroyed) return;
|
|
415
415
|
// 'transfer-encoding': 'chunked'时,无content-length,axios v1.2 不能自动解压
|
|
@@ -482,26 +482,28 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
|
|
|
482
482
|
}
|
|
483
483
|
});
|
|
484
484
|
});
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
485
|
+
// 非stream模式需发送数据,由request处理
|
|
486
|
+
// if (utils.isStream(data)) {
|
|
487
|
+
// // Send the request
|
|
488
|
+
// let ended = false
|
|
489
|
+
// let errored = false
|
|
490
|
+
// data.on('end', () => {
|
|
491
|
+
// ended = true
|
|
492
|
+
// })
|
|
493
|
+
// data.once(
|
|
494
|
+
// 'error',
|
|
495
|
+
// /** @param {*} err */ err => {
|
|
496
|
+
// errored = true
|
|
497
|
+
// req.destroy(err)
|
|
498
|
+
// }
|
|
499
|
+
// )
|
|
500
|
+
// data.on('close', () => {
|
|
501
|
+
// if (!ended && !errored) {
|
|
502
|
+
// abort(new CanceledError('Request stream has been aborted', config, req))
|
|
503
|
+
// }
|
|
504
|
+
// })
|
|
505
|
+
// data.pipe(req) // stream 写入数据
|
|
506
|
+
// } else req.end(data)
|
|
505
507
|
}
|
|
506
508
|
});
|
|
507
509
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiajs/req",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.20",
|
|
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.
|
|
146
|
+
"@wiajs/request": "^3.0.26",
|
|
147
147
|
"@wiajs/agent": "^1.0.21",
|
|
148
148
|
"form-data": "^4.0.0",
|
|
149
149
|
"proxy-from-env": "^1.1.0"
|