* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText)
| 9705 | * - calls $apply |
| 9706 | */ |
| 9707 | function done(status, response, headersString, statusText) { |
| 9708 | if (cache) { |
| 9709 | if (isSuccess(status)) { |
| 9710 | cache.put(url, [status, response, parseHeaders(headersString), statusText]); |
| 9711 | } else { |
| 9712 | // remove promise from the cache |
| 9713 | cache.remove(url); |
| 9714 | } |
| 9715 | } |
| 9716 | |
| 9717 | function resolveHttpPromise() { |
| 9718 | resolvePromise(response, status, headersString, statusText); |
| 9719 | } |
| 9720 | |
| 9721 | if (useApplyAsync) { |
| 9722 | $rootScope.$applyAsync(resolveHttpPromise); |
| 9723 | } else { |
| 9724 | resolveHttpPromise(); |
| 9725 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 9726 | } |
| 9727 | } |
| 9728 | |
| 9729 | |
| 9730 | /** |
no test coverage detected