Skip to content

Commit c1a0d97

Browse files
committed
Added timeout handling to avoid getting stuck when a website or service is not responding to a request
1 parent 7d2643a commit c1a0d97

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/spec-utils/httpRequest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export async function request(options: { type: string; url: string; headers: Rec
4040
res.on('data', chunk => chunks.push(chunk as Buffer));
4141
res.on('end', () => resolve(Buffer.concat(chunks)));
4242
}
43+
}).setTimeout(2000, () => {
44+
req.end();
4345
});
4446
req.on('error', reject);
4547
if (options.data) {

0 commit comments

Comments
 (0)