title: Angular5 http reponse interceptor unable to read status code
body: <p>I am trying to intercept http responses and redirect any 401's but the err object below is only returning me the following string. I was expecting to at least find the status code..</p>
  
  <blockquote>
    <p>401 - Unauthorized Details: Http failure response for
    <a href="http://localhost:4200/api/foo" rel="nofollow noreferrer">http://localhost:4200/api/foo</a>: 401 Unauthorized</p>
  </blockquote>
  
  <p>I can see in the network tab that a well formed 401 is being returned by the server. Any ideas on how I can read them correctly?</p>
  
  <pre><code>intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      const authRequest = request.clone({
          setHeaders: {
              Authorization: `Bearer ${this.authService.getToken() || ''}`
          }
      });
  
      return next.handle(authRequest).do(event =&gt; { }, err =&gt; {
          if (err instanceof HttpErrorResponse &amp;&amp; err.status === 401) {
              this.authService.handleAuthentication();
          }
      });
  }
  </code></pre>
  
  <p>Edit: I have just noticed that if i switch off the web server to force a 504 gateway timeout I get the error as a complete string without an error code as well.</p>
  
  <blockquote>
    <p>504 - Gateway Timeout Details: Http failure response for
    <a href="http://localhost:4200/api/foo" rel="nofollow noreferrer">http://localhost:4200/api/foo</a>: 504 Gateway Timeout</p>
  </blockquote>