Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/platform/request/common/requestIpc.ts')
-rw-r--r--src/vs/platform/request/common/requestIpc.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/vs/platform/request/common/requestIpc.ts b/src/vs/platform/request/common/requestIpc.ts
index 6263e47d71c..b529e5c5d34 100644
--- a/src/vs/platform/request/common/requestIpc.ts
+++ b/src/vs/platform/request/common/requestIpc.ts
@@ -26,31 +26,32 @@ export class RequestChannel implements IServerChannel {
throw new Error('Invalid listen');
}
- call(context: any, command: string, args?: any): Promise<any> {
+ call(context: any, command: string, args?: any, token: CancellationToken = CancellationToken.None): Promise<any> {
switch (command) {
- case 'request': return this.service.request(args[0], CancellationToken.None)
+ case 'request': return this.service.request(args[0], token)
.then(async ({ res, stream }) => {
const buffer = await streamToBuffer(stream);
return <RequestResponse>[{ statusCode: res.statusCode, headers: res.headers }, buffer];
});
+ case 'resolveProxy': return this.service.resolveProxy(args[0]);
}
throw new Error('Invalid call');
}
}
-export class RequestChannelClient {
+export class RequestChannelClient implements IRequestService {
declare readonly _serviceBrand: undefined;
constructor(private readonly channel: IChannel) { }
async request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {
- return RequestChannelClient.request(this.channel, options, token);
+ const [res, buffer] = await this.channel.call<RequestResponse>('request', [options], token);
+ return { res, stream: bufferToStream(buffer) };
}
- static async request(channel: IChannel, options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {
- const [res, buffer] = await channel.call<RequestResponse>('request', [options]);
- return { res, stream: bufferToStream(buffer) };
+ async resolveProxy(url: string): Promise<string | undefined> {
+ return this.channel.call<string | undefined>('resolveProxy', [url]);
}
}