Skip to content

Commit

Permalink
Prevent future attempt at requestservice when in offline mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jul 24, 2018
1 parent 10fa520 commit 427ce6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/vs/platform/request/node/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export interface IHTTPConfiguration {
proxyStrictSSL?: boolean;
proxyAuthorization?: string;
};
workbench?: {
enableOfflineMode?: boolean;
};
}

Registry.as<IConfigurationRegistry>(Extensions.Configuration)
Expand Down
6 changes: 6 additions & 0 deletions src/vs/platform/request/node/requestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class RequestService implements IRequestService {
private proxyUrl: string;
private strictSSL: boolean;
private authorization: string;
private isOfflineMode: boolean;
private disposables: IDisposable[] = [];

constructor(
Expand All @@ -38,9 +39,14 @@ export class RequestService implements IRequestService {
this.proxyUrl = config.http && config.http.proxy;
this.strictSSL = config.http && config.http.proxyStrictSSL;
this.authorization = config.http && config.http.proxyAuthorization;
this.isOfflineMode = config.workbench && config.workbench.enableOfflineMode === true;
}

request(options: IRequestOptions, requestFn: IRequestFunction = request): TPromise<IRequestContext> {
if (this.isOfflineMode) {
return TPromise.as(null);
}

this.logService.trace('RequestService#request', options.url);

const { proxyUrl, strictSSL } = this;
Expand Down

0 comments on commit 427ce6c

Please sign in to comment.