The interceptors are service factories that are registered with the `$httpProvider` by adding them to the `$httpProvider.interceptors` array. The factory is called and injected with dependencies (if specified) and returns the interceptor.
There are two kinds of interceptors (and two kinds of rejection interceptors):
request
: interceptors get called with ahttp
config object. The function is free to modify the config object or create a new one. The function needs to return the config object directly, or a promise containing the config or a new config object.requestError
: interceptor gets called when a previous interceptor threw an error or resolved with a rejection.response
: interceptors get called withhttp
response object. The function is free to modify the response object or create a new one. The function needs to return the response object directly, or as a promise containing the response or a new response object.responseError
: interceptor gets called when a previous interceptor threw an error or resolved with a rejection.
For more information visit $http