* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText, xhrStatus)
| 13326 | * - calls $apply |
| 13327 | */ |
| 13328 | function done(status, response, headersString, statusText, xhrStatus) { |
| 13329 | if (cache) { |
| 13330 | if (isSuccess(status)) { |
| 13331 | cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]); |
| 13332 | } else { |
| 13333 | // remove promise from the cache |
| 13334 | cache.remove(url); |
| 13335 | } |
| 13336 | } |
| 13337 | |
| 13338 | function resolveHttpPromise() { |
| 13339 | resolvePromise(response, status, headersString, statusText, xhrStatus); |
| 13340 | } |
| 13341 | |
| 13342 | if (useApplyAsync) { |
| 13343 | $rootScope.$applyAsync(resolveHttpPromise); |
| 13344 | } else { |
| 13345 | resolveHttpPromise(); |
| 13346 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 13347 | } |
| 13348 | } |
| 13349 | |
| 13350 | |
| 13351 | /** |
no test coverage detected