4

I am using HttpClient to make a sever call and wanted to wait until it respond back. This particular service call takes more than 2 minutes. Following code only waits for 2 minutes even though I have added timeout of 3 minutes.

this.http.get('serverUrl')
.timeout(180000)
.catch(() => {
   return Observable.throw('Error');
});

I also tried implementing timeout with pipe operator. But this approach also timeout after 2 minutes of wait.

this.http.get('serverUrl')
.pipe(timeout(180000))
.catch(() => {
   return Observable.throw('Error');
});

Using timeout, I was able to decrease the service call waiting time but could not increase the waiting time.

I followed some of the previous posts regarding the similar problem, but those solutions did not work.

Can't have a timeout of over 2 minutes with this.http.get?

Increase timeout in Angular 2+ and ASP.NET Core WebAPI application

The expectation is to increase the waiting time more than 2 minutes. I tested in Chrome and IE browser and found that service call using HttpClient is only waiting for 2 minutes for each service call.

Jacopo Sciampi
  • 2,990
  • 1
  • 20
  • 44
dev
  • 451
  • 4
  • 10
  • 23

0 Answers0