* Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply
(status, response, headersString, statusText)
| 11246 | * - calls $apply |
| 11247 | */ |
| 11248 | function done(status, response, headersString, statusText) { |
| 11249 | if (cache) { |
| 11250 | if (isSuccess(status)) { |
| 11251 | cache.put(url, [status, response, parseHeaders(headersString), statusText]); |
| 11252 | } else { |
| 11253 | // remove promise from the cache |
| 11254 | cache.remove(url); |
| 11255 | } |
| 11256 | } |
| 11257 | |
| 11258 | function resolveHttpPromise() { |
| 11259 | resolvePromise(response, status, headersString, statusText); |
| 11260 | } |
| 11261 | |
| 11262 | if (useApplyAsync) { |
| 11263 | $rootScope.$applyAsync(resolveHttpPromise); |
| 11264 | } else { |
| 11265 | resolveHttpPromise(); |
| 11266 | if (!$rootScope.$$phase) $rootScope.$apply(); |
| 11267 | } |
| 11268 | } |
| 11269 | |
| 11270 | |
| 11271 | /** |
no test coverage detected