* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText)
| 10526 | * - calls $apply |
| 10527 | */ |
| 10528 | function done(status, response, headersString, statusText) { |
| 10529 | if (cache) { |
| 10530 | if (isSuccess(status)) { |
| 10531 | cache.put(url, [status, response, parseHeaders(headersString), statusText]); |
| 10532 | } else { |
| 10533 | // remove promise from the cache |
| 10534 | cache.remove(url); |
| 10535 | } |
| 10536 | } |
| 10537 | |
| 10538 | function resolveHttpPromise() { |
| 10539 | resolvePromise(response, status, headersString, statusText); |
| 10540 | } |
| 10541 | |
| 10542 | if (useApplyAsync) { |
| 10543 | $rootScope.$applyAsync(resolveHttpPromise); |
| 10544 | } else { |
| 10545 | resolveHttpPromise(); |
| 10546 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 10547 | } |
| 10548 | } |
| 10549 | |
| 10550 | |
| 10551 | /** |
no test coverage detected