What is the difference between interceptors and transformResponse?

We can modify the data using interceptors and transformRequest and transformresponse.

What is the difference besides the fact that interceptors can only be added globally?

In addition, even downloading partial files is an HTTP request and the data is returned in response. How to deal with this?

+7
angularjs ajax interceptor
source share
1 answer

Differences between Transformers and Interceptors

An interceptor can be used to intercept a request / response at various points, as discussed above. But transformers can be used immediately before sending a request or after receiving a response. Another important thing to consider is that using transformers, you simply access the data and request / response headers during interceptors have access to the configuration object.

From AngularJS - Beginner to Ninja by Sandeep Panda.

In addition, I believe that interceptors are global, while transformers can be global or for every request.

+4
source share

All Articles