This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore($http): remove deprecated responseInterceptors functionality
Code cleanup! response interceptors have been deprecated for some time, and it is confusing to have two APIs, one of which is slightly "hidden" and hard to see, which perform the same task. The newer API is a bit cleaner and more visible, so this is naturally preferred. BREAKING CHANGE: Previously, it was possible to register a response interceptor like so: // register the interceptor as a service $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { return function(promise) { return promise.then(function(response) { // do something on success return response; }, function(response) { // do something on error if (canRecover(response)) { return responseOrNewPromise } return $q.reject(response); }); } }); $httpProvider.responseInterceptors.push('myHttpInterceptor'); Now, one must use the newer API introduced in v1.1.4 (4ae4681), like so: $provide.factory('myHttpInterceptor', function($q) { return { response: function(response) { // do something on success return response; }, responseError: function(response) { // do something on error if (canRecover(response)) { return responseOrNewPromise } return $q.reject(response); } }; }); $httpProvider.interceptors.push('myHttpInterceptor'); More details on the new interceptors API (which has been around as of v1.1.4) can be found at https://docs.angularjs.org/api/ng/service/$http#interceptors Closes #7266 Closes #7267
- Loading branch information
Showing
2 changed files
with
1 addition
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters