* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText, xhrStatus)
| 12755 | * - calls $apply |
| 12756 | */ |
| 12757 | function done(status, response, headersString, statusText, xhrStatus) { |
| 12758 | if (cache) { |
| 12759 | if (isSuccess(status)) { |
| 12760 | cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]); |
| 12761 | } else { |
| 12762 | // remove promise from the cache |
| 12763 | cache.remove(url); |
| 12764 | } |
| 12765 | } |
| 12766 | |
| 12767 | function resolveHttpPromise() { |
| 12768 | resolvePromise(response, status, headersString, statusText, xhrStatus); |
| 12769 | } |
| 12770 | |
| 12771 | if (useApplyAsync) { |
| 12772 | $rootScope.$applyAsync(resolveHttpPromise); |
| 12773 | } else { |
| 12774 | resolveHttpPromise(); |
| 12775 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 12776 | } |
| 12777 | } |
| 12778 | |
| 12779 | |
| 12780 | /** |
no test coverage detected