0

I do have an Angular 5 Application which uses HttpClient to make a backend service call.

If the Service takes some time to return, Angular triggers a second call (Exactly after 120 seconds) which should not happen.

I have verified and there is no retry logic present in the code nor other functioanlity calling the same service again.

Can someone help me understand if this is a bug in Angular 5 or some sort of default beahvior.

public appPost(inputObj: InputObj) {
    return this.httpClient
      .post('_url_', inputObj)
      .timeoutWith(300000, Observable.throw({"error" : "The Application has timed out. Please Contact Administrator."}));
}


this.appService.appPost(inputObj).subscribe(
  (resp: any) => {
    //do something
  },
  error => {
    //throw error
  }
);

Also, I did some debugging and found that the second call is not shown in the network section of chrome debugging tools. But if you add an interceptor and log the calls it gets dispalyed there.

Rajesh
  • 11
  • Can you add a plunker for replication and also the logs of the interceptor – arbghl Feb 27 '19 at 11:54
  • 1
    _Also, I did some debugging and found that the second call is not shown in the network section of chrome debugging tools. But if you add an interceptor and log the calls it gets dispalyed there._ then no 2nd request is done. Mind adding an screenshot of your network requests? – Jota.Toledo Feb 27 '19 at 12:47

1 Answers1

0

I have found a solution to the problem. The issue was happening due to the default timeout set by web pack proxy.

https://stackoverflow.com/a/49089702/10704788

Rajesh
  • 11