* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText)
| 9594 | * - calls $apply |
| 9595 | */ |
| 9596 | function done(status, response, headersString, statusText) { |
| 9597 | if (cache) { |
| 9598 | if (isSuccess(status)) { |
| 9599 | cache.put(url, [status, response, parseHeaders(headersString), statusText]); |
| 9600 | } else { |
| 9601 | // remove promise from the cache |
| 9602 | cache.remove(url); |
| 9603 | } |
| 9604 | } |
| 9605 | |
| 9606 | function resolveHttpPromise() { |
| 9607 | resolvePromise(response, status, headersString, statusText); |
| 9608 | } |
| 9609 | |
| 9610 | if (useApplyAsync) { |
| 9611 | $rootScope.$applyAsync(resolveHttpPromise); |
| 9612 | } else { |
| 9613 | resolveHttpPromise(); |
| 9614 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 9615 | } |
| 9616 | } |
| 9617 | |
| 9618 | |
| 9619 | /** |
no test coverage detected