title: Angular $httpProvider Interceptor and $resource
body: <p>I have a simple Interceptor in angular that intercepts requests and adds a authorization header. It also intercepts a response error of 401 to know if the request failed because of authorization.  </p>
  
  <p>Unfortunately it seems to mess with $resource, because my $resource calls ALWAYS return the success callback and never an error (be it 400 or 500 whatever).</p>
  
  <p>It's definitly the interceptor, because if I remove it, the $resource calls return with the correct callback.</p>
  
  <p>Any ideas on how to fix this behavior?</p>
  
  <p>Here's the interceptors request:</p>
  
  <pre><code>  function request(config) {
      var token = 'whatever-my-token-is';
  
      if (token) {
        config.headers.authorization = token;
      }
  
      return config;
    }
  </code></pre>
  
  <p>And the responseError:</p>
  
  <pre><code>function responseError(response) {
    if (response.status === 401) {
      $rootScope.$broadcast('unauthorized');
    }
  
    return response;
  }
  </code></pre>
  
  <p>Any help appreciated</p>