* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText)
| 10852 | * - calls $apply |
| 10853 | */ |
| 10854 | function done(status, response, headersString, statusText) { |
| 10855 | if (cache) { |
| 10856 | if (isSuccess(status)) { |
| 10857 | cache.put(url, [status, response, parseHeaders(headersString), statusText]); |
| 10858 | } else { |
| 10859 | // remove promise from the cache |
| 10860 | cache.remove(url); |
| 10861 | } |
| 10862 | } |
| 10863 | |
| 10864 | function resolveHttpPromise() { |
| 10865 | resolvePromise(response, status, headersString, statusText); |
| 10866 | } |
| 10867 | |
| 10868 | if (useApplyAsync) { |
| 10869 | $rootScope.$applyAsync(resolveHttpPromise); |
| 10870 | } else { |
| 10871 | resolveHttpPromise(); |
| 10872 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 10873 | } |
| 10874 | } |
| 10875 | |
| 10876 | |
| 10877 | /** |
no test coverage detected