@wiajs/request 3.0.36 → 3.0.37
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/request.cjs +4 -5
- package/dist/request.mjs +4 -5
- package/lib/request.js +1 -1
- package/package.json +2 -2
package/dist/request.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wia request v3.0.
|
|
2
|
+
* wia request v3.0.37
|
|
3
3
|
* (c) 2022-2025 Sibyl Yu and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -11,7 +11,6 @@ const assert = require('assert');
|
|
|
11
11
|
const http = require('http');
|
|
12
12
|
const https = require('https');
|
|
13
13
|
const mime = require('mime-types');
|
|
14
|
-
const stream$1 = require('node:stream');
|
|
15
14
|
const url = require('url');
|
|
16
15
|
const zlib = require('zlib');
|
|
17
16
|
|
|
@@ -498,7 +497,7 @@ const HostNotfoundError = utils.createErrorType('ERR_HOSTNOTFOUND', 'DNS 解析
|
|
|
498
497
|
const ConnRefusedError = utils.createErrorType('ERR_CONNREFUSED', '连接被拒绝,目标服务器可能不可用');
|
|
499
498
|
const ConnTimedoutError = utils.createErrorType('ERR_CONNTIMEDOUT', '请求超时,请检查网络连接或服务器负载');
|
|
500
499
|
const ConnResetError = utils.createErrorType('ERR_CONNRESET', '连接被重置,可能是网络问题或服务器关闭了连接');
|
|
501
|
-
let Request = class Request extends stream
|
|
500
|
+
let Request = class Request extends stream.Duplex {
|
|
502
501
|
/**
|
|
503
502
|
* Executes the next native request (initial or redirect)
|
|
504
503
|
* @returns http(s) 实例
|
|
@@ -1052,7 +1051,7 @@ let Request = class Request extends stream$1.Duplex {
|
|
|
1052
1051
|
}
|
|
1053
1052
|
// 响应流,用于读
|
|
1054
1053
|
// @ts-ignore
|
|
1055
|
-
responseStream = streams.length > 1 ? stream
|
|
1054
|
+
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
1056
1055
|
// 将内部 responseStream 可读流 映射到 redirectReq
|
|
1057
1056
|
// @ts-ignore
|
|
1058
1057
|
m.responseStream = responseStream;
|
|
@@ -1078,7 +1077,7 @@ let Request = class Request extends stream$1.Duplex {
|
|
|
1078
1077
|
}
|
|
1079
1078
|
// 可读流结束,触发 finished,方便上层清理
|
|
1080
1079
|
// A cleanup function which removes all registered listeners.
|
|
1081
|
-
const offListeners = stream
|
|
1080
|
+
const offListeners = stream.finished(responseStream, ()=>{
|
|
1082
1081
|
offListeners() // cleanup
|
|
1083
1082
|
;
|
|
1084
1083
|
this.emit('finished');
|
package/dist/request.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wia request v3.0.
|
|
2
|
+
* wia request v3.0.37
|
|
3
3
|
* (c) 2022-2025 Sibyl Yu and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { log as log$2, name } from '@wiajs/log';
|
|
7
|
-
import stream from 'stream';
|
|
7
|
+
import stream, { Duplex } from 'stream';
|
|
8
8
|
import assert from 'assert';
|
|
9
9
|
import http from 'http';
|
|
10
10
|
import https from 'https';
|
|
11
11
|
import mime from 'mime-types';
|
|
12
|
-
import stream$1, { Duplex } from 'node:stream';
|
|
13
12
|
import url from 'url';
|
|
14
13
|
import zlib from 'zlib';
|
|
15
14
|
|
|
@@ -1049,7 +1048,7 @@ let Request = class Request extends Duplex {
|
|
|
1049
1048
|
}
|
|
1050
1049
|
// 响应流,用于读
|
|
1051
1050
|
// @ts-ignore
|
|
1052
|
-
responseStream = streams.length > 1 ? stream
|
|
1051
|
+
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
1053
1052
|
// 将内部 responseStream 可读流 映射到 redirectReq
|
|
1054
1053
|
// @ts-ignore
|
|
1055
1054
|
m.responseStream = responseStream;
|
|
@@ -1075,7 +1074,7 @@ let Request = class Request extends Duplex {
|
|
|
1075
1074
|
}
|
|
1076
1075
|
// 可读流结束,触发 finished,方便上层清理
|
|
1077
1076
|
// A cleanup function which removes all registered listeners.
|
|
1078
|
-
const offListeners = stream
|
|
1077
|
+
const offListeners = stream.finished(responseStream, ()=>{
|
|
1079
1078
|
offListeners() // cleanup
|
|
1080
1079
|
;
|
|
1081
1080
|
this.emit('finished');
|
package/lib/request.js
CHANGED
|
@@ -6,7 +6,7 @@ import assert from 'assert';
|
|
|
6
6
|
import http from 'http';
|
|
7
7
|
import https from 'https';
|
|
8
8
|
import mime from 'mime-types';
|
|
9
|
-
import stream, { Duplex } from '
|
|
9
|
+
import stream, { Duplex } from 'stream';
|
|
10
10
|
import url from 'url';
|
|
11
11
|
import zlib from 'zlib';
|
|
12
12
|
import ZlibTransform from './ZlibTransform.js';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@wiajs/request",
|
|
3
3
|
"description": "Stream HTTP request client.",
|
|
4
4
|
"keywords": ["http", "simple", "util", "utility"],
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.37",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
46
|
+
"node": ">= 13.14"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@wiajs/log": "^4.3.18",
|