Skip to content

Commit a16897f

Browse files
authored
Add a offline_mode flag. Increase the timeout add user feedback
1 parent a605b23 commit a16897f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/spec-utils/httpRequest.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ export async function request(options: { type: string; url: string; headers: Rec
2323
headers: options.headers,
2424
agent: new ProxyAgent(),
2525
secureContext,
26-
timeout: 3000
26+
timeout: 60000,
2727
};
2828

29+
const offline_mode: boolean = (process.env.OFFLINE_MODE ?? 'false') === 'true';
30+
if (offline_mode) {
31+
output.write('Offline mode enabled, skipping request', LogLevel.Warning);
32+
return;
33+
}
34+
2935
const plainHTTP = parsed.protocol === 'http:' || parsed.hostname === 'localhost';
3036
if (plainHTTP) {
3137
output.write('Sending as plain HTTP request', LogLevel.Warning);
@@ -43,6 +49,7 @@ export async function request(options: { type: string; url: string; headers: Rec
4349
}
4450
});
4551
req.on('timeout', () => {
52+
output.write('Request timed out, aborting', LogLevel.Warning);
4653
req.destroy();
4754
});
4855
req.on('error', reject);

0 commit comments

Comments
 (0)