title: Interceptor in Angular, only for some calls?
body: <p>I have the following factory in my Angular App. It is used to add bearer token information, to the header of all my outgoing request with $resource. It works as expected.</p>
  
  <p>But i have implemented some external calls, which should not be added with the bearer token. How do i implement a check, so i can control what calls are getting intercepted and which are not?</p>
  
  <p>My code:</p>
  
  <pre><code>.factory('authInterceptor', [
        "$q", "$window", "$location", "currentUser", function ($q, $window, $location, currentUser) {
            return {
                request: function(config) {
                    config.headers = config.headers || {};
                    config.headers.Authorization = 'Bearer ' + currentUser.getProfile().token;
                    return config;
                },
                response: function(response) {
                    return response || $q.when(response);
                },
                responseError: function(rejection) {
                    // error handler
                }
            };
        }
      ])
  </code></pre>
  
  <p>Add the authInterceptor:</p>
  
  <pre><code>.config(['$httpProvider', function($httpProvider) {  
      $httpProvider.interceptors.push('authInterceptor');
  }])
  </code></pre>
  
  <p>Factory for a resource:</p>
  
  <pre><code>myApp.factory('Random', function ($resource) {
      return $resource('domain.com', { }, {
          update: {
              method: 'PUT'
          }
      });
  });
  </code></pre>
  
  <p>Call the resource:</p>
  
  <pre><code>Random.query({ });
  </code></pre>
  
  <p>Any ideas?</p>