* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText, xhrStatus)
| 12599 | * - calls $apply |
| 12600 | */ |
| 12601 | function done(status, response, headersString, statusText, xhrStatus) { |
| 12602 | if (cache) { |
| 12603 | if (isSuccess(status)) { |
| 12604 | cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]); |
| 12605 | } else { |
| 12606 | // remove promise from the cache |
| 12607 | cache.remove(url); |
| 12608 | } |
| 12609 | } |
| 12610 | |
| 12611 | function resolveHttpPromise() { |
| 12612 | resolvePromise(response, status, headersString, statusText, xhrStatus); |
| 12613 | } |
| 12614 | |
| 12615 | if (useApplyAsync) { |
| 12616 | $rootScope.$applyAsync(resolveHttpPromise); |
| 12617 | } else { |
| 12618 | resolveHttpPromise(); |
| 12619 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 12620 | } |
| 12621 | } |
| 12622 | |
| 12623 | |
| 12624 | /** |
no test coverage detected