title: Call another http api (without Intercepting) before actual http call is made in Angular's HttpInterceptor
body: <p>I'm using <code>HttpInterceptor</code> api of Angular's <code>HttpClientModule</code> and now stuck with a situation. Here is my use-case.</p>
  
  <p>In my application, if any service makes an http call, I want to make another silent http call before it, and want to store it's result locally. Once the silent call is completed, then only I'll proceed with the service's http call and will return its result.</p>
  
  <p>Here is what I'm  doing. (Using HttpInterceptor)</p>
  
  <pre><code>intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      if (req.url.match(/api\//)) { // api call
             http.post('/auth/silentCall', {user: 123}).subscribe(
                       (data) =&gt; {
                          console.log(data);
                          const clone = req.clone({ setHeaders: { 'Authorization ': tokenService.getToken() } });
                          return  next.handle(clone).do((event: HttpEvent&lt;any&gt;) =&gt; {
                              if (event instanceof HttpResponse) {
                                  console.log('Service's call response');
                              }
                          }, (err: any) =&gt; {
                              if (err instanceof HttpErrorResponse) {
                                  console.log('Network call err', err);
                              }
                          });
                       },
                       (err) =&gt; {
                          if (err instanceof HttpErrorResponse) {
                             return Observable.throw(err); 
                          }
                   );
                  } else {
          console.log('Not an api call..It's an auth call');
         return next.handle(req); // call original auth request.
      }
  }
  </code></pre>
  
  <p>Now, problem with the above code is, it is executing internal silent call successfully, but never calls the original api call after that. So the service keeps waiting forever.</p>