title: How can I resolve a request in an AngularJS $httpProvider interceptor?
body: <p>I hope that I'm missing something here as this seems like it should be pretty straightforward.</p>
  
  <p>I'd like to create an $httpProvider interceptor to take a look at outgoing $http requests and for some (in this case, ones that hit non existent endpoints that I'd like to fake responses for) NOT make the request but resolve it instead with some fake response data.</p>
  
  <p>Here's where I am at right now:</p>
  
  <pre><code>myApp.factory('mockedAPIResponses', ['$q', function($q) {
  
  
   return {
      request: function(config) {
        if (/check for endpoint here/.test(config.url)) {
          // Resolve request such that it actually makes a request to the server
          var defer = $q.defer(config.timeout),
              resolvedRequest = defer.resolve({ fakeResponseData : 'foo'});
          return resolvedRequest;
        }
        return config;
      }
    }
  }]);
  </code></pre>