cvitool 1.0.72 → 1.0.73
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/build/src/hgo.d.ts +7 -1
- package/build/src/hgo.js +94 -55
- package/package.json +3 -3
- package/src/hgo.ts +112 -59
package/build/src/hgo.d.ts
CHANGED
|
@@ -28,10 +28,16 @@ interface reqOptions extends baseReqOptions {
|
|
|
28
28
|
body?: {
|
|
29
29
|
[key: string]: any;
|
|
30
30
|
};
|
|
31
|
+
retries?: number;
|
|
32
|
+
retryInterval?: number;
|
|
33
|
+
[key: string]: any;
|
|
31
34
|
}
|
|
32
35
|
interface reqSendBufferOptions extends baseReqOptions {
|
|
33
|
-
method?: Method;
|
|
34
36
|
buffer: Buffer;
|
|
37
|
+
method?: Method;
|
|
38
|
+
retries?: number;
|
|
39
|
+
retryInterval?: number;
|
|
40
|
+
[key: string]: any;
|
|
35
41
|
}
|
|
36
42
|
interface reqSendStreamOptions extends baseReqOptions {
|
|
37
43
|
method?: Method;
|
package/build/src/hgo.js
CHANGED
|
@@ -26,7 +26,7 @@ function getProtocol(url) {
|
|
|
26
26
|
}
|
|
27
27
|
function request(url, options) {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
let { query = {}, body = {}, headers = {}, timeout = 5000, method = 'get', agent, resType = 'json', connectTimeOut, readTimeOut } = options || {};
|
|
29
|
+
let { query = {}, body = {}, headers = {}, timeout = 5000, method = 'get', agent, resType = 'json', connectTimeOut, readTimeOut, retries, retryInterval, retrieds } = options || {};
|
|
30
30
|
if (timeout && !(connectTimeOut && readTimeOut)) {
|
|
31
31
|
connectTimeOut = timeout;
|
|
32
32
|
readTimeOut = timeout;
|
|
@@ -49,72 +49,108 @@ function request(url, options) {
|
|
|
49
49
|
'Content-length': Buffer.byteLength(data)
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
req.end();
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
req.write(data, (e) => {
|
|
74
|
-
req.end();
|
|
75
|
-
if (e) {
|
|
76
|
-
req.destroy();
|
|
77
|
-
reject(e);
|
|
78
|
-
}
|
|
52
|
+
let res;
|
|
53
|
+
try {
|
|
54
|
+
res = yield new Promise((resolve, reject) => {
|
|
55
|
+
const req = protocol.request(url, {
|
|
56
|
+
timeout: connectTimeOut,
|
|
57
|
+
headers: Object.assign(headers, baseHeaders),
|
|
58
|
+
method,
|
|
59
|
+
agent
|
|
60
|
+
}, res => {
|
|
61
|
+
resHandld(res, resolve, reject, resType, method, readTimeOut, req);
|
|
62
|
+
});
|
|
63
|
+
req.on('timeout', () => {
|
|
64
|
+
req.destroy();
|
|
65
|
+
reject(buildTimeOutErr('connectTimeOut', connectTimeOut, url));
|
|
66
|
+
});
|
|
67
|
+
req.on('error', e => {
|
|
68
|
+
req.destroy();
|
|
69
|
+
reject(e);
|
|
79
70
|
});
|
|
71
|
+
if (isbodyEmpty) {
|
|
72
|
+
req.end();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
req.write(data, (e) => {
|
|
76
|
+
req.end();
|
|
77
|
+
if (e) {
|
|
78
|
+
req.destroy();
|
|
79
|
+
reject(e);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
if ((retrieds || 0) < (retries || 0)) {
|
|
87
|
+
if (retryInterval) {
|
|
88
|
+
yield new Promise((resolve) => {
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
resolve(1);
|
|
91
|
+
}, retryInterval);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
res = yield request(url, Object.assign(Object.assign({}, options), { retrieds: (retrieds || 0) + 1 }));
|
|
95
|
+
return res;
|
|
80
96
|
}
|
|
81
|
-
|
|
97
|
+
throw e;
|
|
98
|
+
}
|
|
99
|
+
return res;
|
|
82
100
|
});
|
|
83
101
|
}
|
|
84
102
|
exports.request = request;
|
|
85
103
|
function reqSendBuffer(url, options) {
|
|
86
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
let { timeout = 5000, headers = {}, buffer, method = 'post', agent, resType = 'json', connectTimeOut, readTimeOut } = options;
|
|
105
|
+
let { timeout = 5000, headers = {}, buffer, method = 'post', agent, resType = 'json', connectTimeOut, readTimeOut, retries, retryInterval, retrieds } = options;
|
|
88
106
|
if (timeout && !(connectTimeOut && readTimeOut)) {
|
|
89
107
|
connectTimeOut = timeout;
|
|
90
108
|
readTimeOut = timeout;
|
|
91
109
|
}
|
|
92
110
|
const protocol = getProtocol(url);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
req.write(buffer, (e) => {
|
|
111
|
-
req.end();
|
|
112
|
-
if (e) {
|
|
111
|
+
let res;
|
|
112
|
+
try {
|
|
113
|
+
res = yield new Promise((resolve, reject) => {
|
|
114
|
+
const req = protocol.request(url, {
|
|
115
|
+
timeout: connectTimeOut,
|
|
116
|
+
headers: Object.assign(headers, { 'Content-Length': buffer.byteLength }),
|
|
117
|
+
method,
|
|
118
|
+
agent
|
|
119
|
+
}, res => {
|
|
120
|
+
resHandld(res, resolve, reject, resType, method, readTimeOut, req);
|
|
121
|
+
});
|
|
122
|
+
req.on('timeout', () => {
|
|
123
|
+
req.destroy();
|
|
124
|
+
reject(buildTimeOutErr('connectTimeOut', connectTimeOut, url));
|
|
125
|
+
});
|
|
126
|
+
req.on('error', e => {
|
|
113
127
|
req.destroy();
|
|
114
128
|
reject(e);
|
|
115
|
-
}
|
|
129
|
+
});
|
|
130
|
+
req.write(buffer, (e) => {
|
|
131
|
+
req.end();
|
|
132
|
+
if (e) {
|
|
133
|
+
req.destroy();
|
|
134
|
+
reject(e);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
116
137
|
});
|
|
117
|
-
}
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
if ((retrieds || 0) < (retries || 0)) {
|
|
141
|
+
if (retryInterval) {
|
|
142
|
+
yield new Promise((resolve) => {
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
resolve(1);
|
|
145
|
+
}, retryInterval);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
res = yield reqSendBuffer(url, Object.assign(Object.assign({}, options), { retrieds: (retrieds || 0) + 1 }));
|
|
149
|
+
return res;
|
|
150
|
+
}
|
|
151
|
+
throw e;
|
|
152
|
+
}
|
|
153
|
+
return res;
|
|
118
154
|
});
|
|
119
155
|
}
|
|
120
156
|
exports.reqSendBuffer = reqSendBuffer;
|
|
@@ -126,7 +162,7 @@ function reqSendStream(url, options) {
|
|
|
126
162
|
readTimeOut = timeout;
|
|
127
163
|
}
|
|
128
164
|
const protocol = getProtocol(url);
|
|
129
|
-
|
|
165
|
+
const res = yield new Promise((resolve, reject) => {
|
|
130
166
|
const baseHeaders = {
|
|
131
167
|
'Content-Type': 'application/octet-stream',
|
|
132
168
|
'Transfer-Encoding': 'chunked',
|
|
@@ -151,6 +187,7 @@ function reqSendStream(url, options) {
|
|
|
151
187
|
stream.on('data', chunk => {
|
|
152
188
|
req.write(chunk, e => {
|
|
153
189
|
if (e) {
|
|
190
|
+
stream.close();
|
|
154
191
|
req.destroy();
|
|
155
192
|
reject(e);
|
|
156
193
|
}
|
|
@@ -158,7 +195,6 @@ function reqSendStream(url, options) {
|
|
|
158
195
|
});
|
|
159
196
|
stream.on('end', () => {
|
|
160
197
|
req.end();
|
|
161
|
-
stream.close();
|
|
162
198
|
});
|
|
163
199
|
stream.on('error', e => {
|
|
164
200
|
req.destroy();
|
|
@@ -166,6 +202,7 @@ function reqSendStream(url, options) {
|
|
|
166
202
|
reject(e);
|
|
167
203
|
});
|
|
168
204
|
});
|
|
205
|
+
return res;
|
|
169
206
|
});
|
|
170
207
|
}
|
|
171
208
|
exports.reqSendStream = reqSendStream;
|
|
@@ -177,7 +214,7 @@ function reqSendMultiPart(url, options) {
|
|
|
177
214
|
readTimeOut = timeout;
|
|
178
215
|
}
|
|
179
216
|
const protocol = getProtocol(url);
|
|
180
|
-
|
|
217
|
+
const res = yield new Promise((resolve, reject) => {
|
|
181
218
|
const req = protocol.request(url, {
|
|
182
219
|
timeout: connectTimeOut,
|
|
183
220
|
headers: Object.assign(headers, Object.assign({}, form.getHeaders())),
|
|
@@ -192,6 +229,7 @@ function reqSendMultiPart(url, options) {
|
|
|
192
229
|
});
|
|
193
230
|
req.on('error', e => {
|
|
194
231
|
req.destroy();
|
|
232
|
+
form.destroy();
|
|
195
233
|
reject(e);
|
|
196
234
|
});
|
|
197
235
|
form.pipe(req);
|
|
@@ -204,6 +242,7 @@ function reqSendMultiPart(url, options) {
|
|
|
204
242
|
reject(e);
|
|
205
243
|
});
|
|
206
244
|
});
|
|
245
|
+
return res;
|
|
207
246
|
});
|
|
208
247
|
}
|
|
209
248
|
exports.reqSendMultiPart = reqSendMultiPart;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cvitool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.73",
|
|
4
4
|
"description": "cvitool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {},
|
|
11
11
|
"devDependencies": {
|
|
12
|
+
"@types/node": "20.10.4",
|
|
12
13
|
"@typescript-eslint/eslint-plugin": "5.54.0",
|
|
13
14
|
"@typescript-eslint/parser": "5.54.0",
|
|
14
15
|
"eslint": "7.32.0",
|
|
15
|
-
"eslint-config-standard": "16.0.3"
|
|
16
|
-
"@types/node": "20.10.4"
|
|
16
|
+
"eslint-config-standard": "16.0.3"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=16.0.0"
|
package/src/hgo.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface baseReqOptions {
|
|
|
18
18
|
},
|
|
19
19
|
resType?: ResType,
|
|
20
20
|
connectTimeOut?: number,
|
|
21
|
-
readTimeOut?: number
|
|
21
|
+
readTimeOut?: number
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
interface reqOptions extends baseReqOptions {
|
|
@@ -28,12 +28,18 @@ interface reqOptions extends baseReqOptions {
|
|
|
28
28
|
},
|
|
29
29
|
body?: {
|
|
30
30
|
[key: string]: any
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
retries?: number,
|
|
33
|
+
retryInterval?: number,
|
|
34
|
+
[key: string]: any
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
interface reqSendBufferOptions extends baseReqOptions {
|
|
38
|
+
buffer: Buffer,
|
|
35
39
|
method?: Method,
|
|
36
|
-
|
|
40
|
+
retries?: number,
|
|
41
|
+
retryInterval?: number,
|
|
42
|
+
[key: string]: any
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
interface reqSendStreamOptions extends baseReqOptions {
|
|
@@ -65,7 +71,10 @@ function getProtocol(url: string) {
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
async function request(url: string, options?: reqOptions): Promise<ResData> {
|
|
68
|
-
let {
|
|
74
|
+
let {
|
|
75
|
+
query = {}, body = {}, headers = {}, timeout = 5000, method = 'get', agent, resType = 'json', connectTimeOut,
|
|
76
|
+
readTimeOut, retries, retryInterval, retrieds
|
|
77
|
+
} = options || {};
|
|
69
78
|
if (timeout && !(connectTimeOut && readTimeOut)) {
|
|
70
79
|
connectTimeOut = timeout;
|
|
71
80
|
readTimeOut = timeout;
|
|
@@ -87,79 +96,118 @@ async function request(url: string, options?: reqOptions): Promise<ResData> {
|
|
|
87
96
|
'Content-length': Buffer.byteLength(data)
|
|
88
97
|
};
|
|
89
98
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
req.destroy();
|
|
105
|
-
reject(e);
|
|
106
|
-
});
|
|
107
|
-
if (isbodyEmpty) {
|
|
108
|
-
req.end();
|
|
109
|
-
} else {
|
|
110
|
-
req.write(data, (e) => {
|
|
111
|
-
req.end();
|
|
112
|
-
if (e) {
|
|
113
|
-
req.destroy();
|
|
114
|
-
reject(e);
|
|
115
|
-
}
|
|
99
|
+
let res: ResData;
|
|
100
|
+
try {
|
|
101
|
+
res = await new Promise((resolve, reject) => {
|
|
102
|
+
const req = protocol.request(url, {
|
|
103
|
+
timeout: connectTimeOut,
|
|
104
|
+
headers: Object.assign(headers, baseHeaders),
|
|
105
|
+
method,
|
|
106
|
+
agent
|
|
107
|
+
}, res => {
|
|
108
|
+
resHandld(res, resolve, reject, resType, method, readTimeOut, req);
|
|
109
|
+
});
|
|
110
|
+
req.on('timeout', () => {
|
|
111
|
+
req.destroy();
|
|
112
|
+
reject(buildTimeOutErr('connectTimeOut', connectTimeOut, url));
|
|
116
113
|
});
|
|
114
|
+
req.on('error', e => {
|
|
115
|
+
req.destroy();
|
|
116
|
+
reject(e);
|
|
117
|
+
});
|
|
118
|
+
if (isbodyEmpty) {
|
|
119
|
+
req.end();
|
|
120
|
+
} else {
|
|
121
|
+
req.write(data, (e) => {
|
|
122
|
+
req.end();
|
|
123
|
+
if (e) {
|
|
124
|
+
req.destroy();
|
|
125
|
+
reject(e);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
} catch (e) {
|
|
131
|
+
if ((retrieds || 0) < (retries || 0)) {
|
|
132
|
+
if (retryInterval) {
|
|
133
|
+
await new Promise((resolve) => {
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
resolve(1);
|
|
136
|
+
}, retryInterval);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
res = await request(url, { ...options, retrieds: (retrieds || 0) + 1 });
|
|
140
|
+
return res;
|
|
117
141
|
}
|
|
118
|
-
|
|
142
|
+
throw e;
|
|
143
|
+
}
|
|
144
|
+
return res;
|
|
119
145
|
}
|
|
120
146
|
|
|
121
147
|
async function reqSendBuffer(url: string, options: reqSendBufferOptions): Promise<ResData> {
|
|
122
|
-
let {
|
|
148
|
+
let {
|
|
149
|
+
timeout = 5000, headers = {}, buffer, method = 'post', agent, resType = 'json', connectTimeOut, readTimeOut,
|
|
150
|
+
retries, retryInterval, retrieds
|
|
151
|
+
} = options;
|
|
123
152
|
if (timeout && !(connectTimeOut && readTimeOut)) {
|
|
124
153
|
connectTimeOut = timeout;
|
|
125
154
|
readTimeOut = timeout;
|
|
126
155
|
}
|
|
127
156
|
const protocol = getProtocol(url);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
req.write(buffer, (e) => {
|
|
146
|
-
req.end();
|
|
147
|
-
if (e) {
|
|
157
|
+
let res: ResData;
|
|
158
|
+
try {
|
|
159
|
+
res = await new Promise((resolve, reject) => {
|
|
160
|
+
const req = protocol.request(url, {
|
|
161
|
+
timeout: connectTimeOut,
|
|
162
|
+
headers: Object.assign(headers, { 'Content-Length': buffer.byteLength }),
|
|
163
|
+
method,
|
|
164
|
+
agent
|
|
165
|
+
}, res => {
|
|
166
|
+
resHandld(res, resolve, reject, resType, method, readTimeOut, req);
|
|
167
|
+
});
|
|
168
|
+
req.on('timeout', () => {
|
|
169
|
+
req.destroy();
|
|
170
|
+
reject(buildTimeOutErr('connectTimeOut', connectTimeOut, url));
|
|
171
|
+
});
|
|
172
|
+
req.on('error', e => {
|
|
148
173
|
req.destroy();
|
|
149
174
|
reject(e);
|
|
150
|
-
}
|
|
175
|
+
});
|
|
176
|
+
req.write(buffer, (e) => {
|
|
177
|
+
req.end();
|
|
178
|
+
if (e) {
|
|
179
|
+
req.destroy();
|
|
180
|
+
reject(e);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
151
183
|
});
|
|
152
|
-
})
|
|
184
|
+
} catch (e) {
|
|
185
|
+
if ((retrieds || 0) < (retries || 0)) {
|
|
186
|
+
if (retryInterval) {
|
|
187
|
+
await new Promise((resolve) => {
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
resolve(1);
|
|
190
|
+
}, retryInterval);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
res = await reqSendBuffer(url, { ...options, retrieds: (retrieds || 0) + 1 });
|
|
194
|
+
return res;
|
|
195
|
+
}
|
|
196
|
+
throw e;
|
|
197
|
+
}
|
|
198
|
+
return res;
|
|
153
199
|
}
|
|
154
200
|
|
|
155
201
|
async function reqSendStream(url: string, options: reqSendStreamOptions): Promise<ResData> {
|
|
156
|
-
let {
|
|
202
|
+
let {
|
|
203
|
+
timeout = 5000, method = 'post', stream, headers = {}, agent, resType = 'json', connectTimeOut, readTimeOut
|
|
204
|
+
} = options;
|
|
157
205
|
if (timeout && !(connectTimeOut && readTimeOut)) {
|
|
158
206
|
connectTimeOut = timeout;
|
|
159
207
|
readTimeOut = timeout;
|
|
160
208
|
}
|
|
161
209
|
const protocol = getProtocol(url);
|
|
162
|
-
|
|
210
|
+
const res: ResData = await new Promise((resolve, reject) => {
|
|
163
211
|
const baseHeaders = {
|
|
164
212
|
'Content-Type': 'application/octet-stream',
|
|
165
213
|
'Transfer-Encoding': 'chunked',
|
|
@@ -184,6 +232,7 @@ async function reqSendStream(url: string, options: reqSendStreamOptions): Promis
|
|
|
184
232
|
stream.on('data', chunk => {
|
|
185
233
|
req.write(chunk, e => {
|
|
186
234
|
if (e) {
|
|
235
|
+
stream.close();
|
|
187
236
|
req.destroy();
|
|
188
237
|
reject(e);
|
|
189
238
|
}
|
|
@@ -191,7 +240,6 @@ async function reqSendStream(url: string, options: reqSendStreamOptions): Promis
|
|
|
191
240
|
});
|
|
192
241
|
stream.on('end', () => {
|
|
193
242
|
req.end();
|
|
194
|
-
stream.close();
|
|
195
243
|
});
|
|
196
244
|
stream.on('error', e => {
|
|
197
245
|
req.destroy();
|
|
@@ -199,16 +247,19 @@ async function reqSendStream(url: string, options: reqSendStreamOptions): Promis
|
|
|
199
247
|
reject(e);
|
|
200
248
|
});
|
|
201
249
|
});
|
|
250
|
+
return res;
|
|
202
251
|
}
|
|
203
252
|
|
|
204
253
|
async function reqSendMultiPart(url: string, options: reqSendMultiPartOptions): Promise<ResData> {
|
|
205
|
-
let {
|
|
254
|
+
let {
|
|
255
|
+
timeout = 60000, headers = {}, form, agent, resType = 'json', connectTimeOut, readTimeOut
|
|
256
|
+
} = options;
|
|
206
257
|
if (timeout && !(connectTimeOut && readTimeOut)) {
|
|
207
258
|
connectTimeOut = timeout;
|
|
208
259
|
readTimeOut = timeout;
|
|
209
260
|
}
|
|
210
261
|
const protocol = getProtocol(url);
|
|
211
|
-
|
|
262
|
+
const res: ResData = await new Promise((resolve, reject) => {
|
|
212
263
|
const req = protocol.request(url, {
|
|
213
264
|
timeout: connectTimeOut,
|
|
214
265
|
headers: Object.assign(headers, { ...form.getHeaders() }),
|
|
@@ -223,6 +274,7 @@ async function reqSendMultiPart(url: string, options: reqSendMultiPartOptions):
|
|
|
223
274
|
});
|
|
224
275
|
req.on('error', e => {
|
|
225
276
|
req.destroy();
|
|
277
|
+
form.destroy();
|
|
226
278
|
reject(e);
|
|
227
279
|
});
|
|
228
280
|
form.pipe(req);
|
|
@@ -235,6 +287,7 @@ async function reqSendMultiPart(url: string, options: reqSendMultiPartOptions):
|
|
|
235
287
|
reject(e);
|
|
236
288
|
});
|
|
237
289
|
});
|
|
290
|
+
return res;
|
|
238
291
|
}
|
|
239
292
|
|
|
240
293
|
function resHandld(res: http.IncomingMessage, resolve: any, reject: any, resType: ResType, method: Method, readTimeOut: number, req: http.ClientRequest) {
|