Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/spec-utils/httpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export async function request(options: { type: string; url: string; headers: Rec
secureContext,
};

const offline_mode: boolean = (process.env.OFFLINE_MODE ?? 'false') === 'true';
if (offline_mode) {
// Use the exception handling as a signal to skip the request
const err = `Offline mode enabled. Aboring request.`;
throw new Error(err);
}

const plainHTTP = parsed.protocol === 'http:' || parsed.hostname === 'localhost';
if (plainHTTP) {
output.write('Sending as plain HTTP request', LogLevel.Warning);
Expand Down