Introduce request handler in web api

This commit is contained in:
Sandeep Somavarapu
2019-07-14 23:27:08 +02:00
parent c0e7048e79
commit a60a8aef78
4 changed files with 18 additions and 5 deletions

View File

@@ -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) {