mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-30 13:31:07 +01:00
Introduce request handler in web api
This commit is contained in:
@@ -16,6 +16,7 @@ export class WebRequestService extends RequestService {
|
||||
private readonly remoteRequestChannel: RequestChannelClient | null;
|
||||
|
||||
constructor(
|
||||
private readonly requestHandler: ((options: IRequestOptions) => Promise<IRequestContext>) | undefined,
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ILogService logService: ILogService
|
||||
@@ -26,6 +27,9 @@ export class WebRequestService extends RequestService {
|
||||
}
|
||||
|
||||
async request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {
|
||||
if (this.requestHandler) {
|
||||
return this.requestHandler(options);
|
||||
}
|
||||
try {
|
||||
const context = await super.request(options, token);
|
||||
if (this.remoteRequestChannel && context.res.statusCode === 405) {
|
||||
|
||||
Reference in New Issue
Block a user