From c1a0d9735a373934e013c5ee49dd3ba3c482f02f Mon Sep 17 00:00:00 2001 From: Raphael Mayr Date: Wed, 28 Jan 2026 23:05:10 +0100 Subject: [PATCH 1/2] Added timeout handling to avoid getting stuck when a website or service is not responding to a request --- src/spec-utils/httpRequest.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/spec-utils/httpRequest.ts b/src/spec-utils/httpRequest.ts index 43df09d78..d7582d003 100644 --- a/src/spec-utils/httpRequest.ts +++ b/src/spec-utils/httpRequest.ts @@ -40,6 +40,8 @@ export async function request(options: { type: string; url: string; headers: Rec res.on('data', chunk => chunks.push(chunk as Buffer)); res.on('end', () => resolve(Buffer.concat(chunks))); } + }).setTimeout(2000, () => { + req.end(); }); req.on('error', reject); if (options.data) { From a605b23b0b7b70e4307fa504001463705e3eab71 Mon Sep 17 00:00:00 2001 From: RaMaTHA <157792803+RaMaTHA@users.noreply.github.com> Date: Fri, 30 Jan 2026 10:32:47 +0100 Subject: [PATCH 2/2] Updated according to @abdurriq feedback --- src/spec-utils/httpRequest.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/spec-utils/httpRequest.ts b/src/spec-utils/httpRequest.ts index d7582d003..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'; @@ -40,8 +41,9 @@ export async function request(options: { type: string; url: string; headers: Rec res.on('data', chunk => chunks.push(chunk as Buffer)); res.on('end', () => resolve(Buffer.concat(chunks))); } - }).setTimeout(2000, () => { - req.end(); + }); + req.on('timeout', () => { + req.destroy(); }); req.on('error', reject); if (options.data) {