We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c1a0d97 commit a605b23Copy full SHA for a605b23
1 file changed
src/spec-utils/httpRequest.ts
@@ -23,6 +23,7 @@ export async function request(options: { type: string; url: string; headers: Rec
23
headers: options.headers,
24
agent: new ProxyAgent(),
25
secureContext,
26
+ timeout: 3000
27
};
28
29
const plainHTTP = parsed.protocol === 'http:' || parsed.hostname === 'localhost';
@@ -40,8 +41,9 @@ export async function request(options: { type: string; url: string; headers: Rec
40
41
res.on('data', chunk => chunks.push(chunk as Buffer));
42
res.on('end', () => resolve(Buffer.concat(chunks)));
43
}
- }).setTimeout(2000, () => {
44
- req.end();
+ });
45
+ req.on('timeout', () => {
46
+ req.destroy();
47
});
48
req.on('error', reject);
49
if (options.data) {
0 commit comments