diff --git a/src/spec-utils/httpRequest.ts b/src/spec-utils/httpRequest.ts index 43df09d78..9191c151f 100644 --- a/src/spec-utils/httpRequest.ts +++ b/src/spec-utils/httpRequest.ts @@ -23,6 +23,7 @@ export async function request(options: { type: string; url: string; headers: Rec headers: options.headers, agent: new ProxyAgent(), secureContext, + timeout: 3000 }; const plainHTTP = parsed.protocol === 'http:' || parsed.hostname === 'localhost'; @@ -41,6 +42,9 @@ export async function request(options: { type: string; url: string; headers: Rec res.on('end', () => resolve(Buffer.concat(chunks))); } }); + req.on('timeout', () => { + req.destroy(); + }); req.on('error', reject); if (options.data) { req.write(options.data);