title: Angular4 Interceptor change response
body: <p>I have an auth <code>HttpInterceptor</code>:</p>
  
  <pre><code>import {HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, 
  HttpRequest} from '@angular/common/http';
  import {AuthService} from '../service/auth.service';
  import {Observable} from 'rxjs/Observable';
  import {Injectable} from '@angular/core';
  import {Router} from '@angular/router';
  
  @Injectable()
  export class AuthInterceptor implements HttpInterceptor {
    constructor(private authService: AuthService,
                private router: Router) {
    }
  
    intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      const authHeader = this.authService.getToken();
      const clone = req.clone({headers: req.headers.set('Authorization',authHeader)});
      return next.handle(clone).do(() =&gt; {
  }, err =&gt; {
    console.log(err);
    if (err instanceof HttpErrorResponse &amp;&amp; err.status === 401) {
      this.authService.clearToken();
      this.router.navigate(['/auth/signin']);
      return Observable.empty();
        }
      });
    }
  }
  </code></pre>
  
  <p>This interceptor works fine, but when i'm getting 401 i'm redirecting user to login page, but the error still goes to the service, and in that service i'm showing error msg, and this msg showing at signin page. So i want to change response or do something in <code>if (err instanceof HttpErrorResponse &amp;&amp; err.status === 401) {</code> block, to not returning error in this case.</p>
  
  <pre><code>return Observable.empty();
  </code></pre>
  
  <p>is not working</p>