angular/http — pull request #26 by jeffbcross (2014-06-23 16:21:34+00:00)
Title: Intercept

Just opening this for review and discussion of the intercept API. Not ready to merge.

Jist:

```javascript
inject(Http, function(http) {
http.globalInterceptors.response.push(function(err, req, res) {
// The response interceptors should only be operating on the response,
// but the request is available for context
res.body = 'foo body';
return res;
});
});
```
Also supports returning a promise for async interception.

TODO:

* The intercept function is a little too node-y, not very promisy. e.g. all response/responseError interceptors get added to the same queue, and have an optional first argument for err, much like a node callback. This API should be adapted to use separate resolve/reject handlers. Perhaps the API could allow pushing a tuple to `globalInterceptors[type]`, such as `http.globalInterceptors.response.push({resolve: someFunc, reject: someFunc});`
* Add more tests for more cases
* Stop using zones for testing ConnectionMock/PromiseBackend, just patch promise global in beforeEach and afterEach. Zones add needless bloat to tests, with no value.
* Clean up PR (squash commits, resolve issues with upstream commits, etc)