angular/angular.js — pull request #6734 by just-boris (2014-03-18 12:23:53+00:00)
Title: feat($http): pass success flag to transformResponse

Now `transformResponse` doesn't know about request is successful or not.
So, it is impossible to make some transformation only on success response. For example, I wrap response into object for easier handling:

```javascript
function Post(data) {
this.author = data.user.name;
this.annotation = data.content.split('\n')[0];
}

$http.get('/posts', {
transformResponse: function transformResponse(data) {
return new Post(data)
}
});
```

When request has failed, response doesn't contain a fields required by the post and it causes an Exeption.
With this fix I will can create the post only from success responses

```javascript
$http.get('/posts', {
transformResponse: function transformResponse(data, headers, success) {
return success ? new Post(data) : data
}
});
```