Skip to content

Commit 84db8e4

Browse files
authored
Remove the timeout handling. Add error throw with feedback information.
1 parent a16897f commit 84db8e4

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/spec-utils/httpRequest.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export async function request(options: { type: string; url: string; headers: Rec
2323
headers: options.headers,
2424
agent: new ProxyAgent(),
2525
secureContext,
26-
timeout: 60000,
2726
};
2827

2928
const offline_mode: boolean = (process.env.OFFLINE_MODE ?? 'false') === 'true';
3029
if (offline_mode) {
31-
output.write('Offline mode enabled, skipping request', LogLevel.Warning);
32-
return;
30+
// Use the exception handling as a signal to skip the request
31+
const err = `Offline mode enabled. Aboring request.`;
32+
throw new Error(err);
3333
}
3434

3535
const plainHTTP = parsed.protocol === 'http:' || parsed.hostname === 'localhost';
@@ -48,10 +48,6 @@ export async function request(options: { type: string; url: string; headers: Rec
4848
res.on('end', () => resolve(Buffer.concat(chunks)));
4949
}
5050
});
51-
req.on('timeout', () => {
52-
output.write('Request timed out, aborting', LogLevel.Warning);
53-
req.destroy();
54-
});
5551
req.on('error', reject);
5652
if (options.data) {
5753
req.write(options.data);

0 commit comments

Comments
 (0)