* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText)
| 12062 | * - calls $apply |
| 12063 | */ |
| 12064 | function done(status, response, headersString, statusText) { |
| 12065 | if (cache) { |
| 12066 | if (isSuccess(status)) { |
| 12067 | cache.put(url, [status, response, parseHeaders(headersString), statusText]); |
| 12068 | } else { |
| 12069 | // remove promise from the cache |
| 12070 | cache.remove(url); |
| 12071 | } |
| 12072 | } |
| 12073 | |
| 12074 | function resolveHttpPromise() { |
| 12075 | resolvePromise(response, status, headersString, statusText); |
| 12076 | } |
| 12077 | |
| 12078 | if (useApplyAsync) { |
| 12079 | $rootScope.$applyAsync(resolveHttpPromise); |
| 12080 | } else { |
| 12081 | resolveHttpPromise(); |
| 12082 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 12083 | } |
| 12084 | } |
| 12085 | |
| 12086 | |
| 12087 | /** |
no test coverage detected