As a framework, angular is capable of providing people with a set of capabilities and tools that are usually out of the box. Though the name sounds quite complicated and a bit fancy, it is nothing but a special HTTP client service. It has only one sole purpose- to intercept every HTTP request, both outgoing and incoming. The interceptor will be in the middle of both outgoing and incoming requests. It performs tasks like adding a customized HTTP header to the final outgoing requests along with logging to the right metrics, error handling, and caching. A similar thing happens when the server replies.
Work Process
There is no need to create multiple layers of duplication during consuming a response and performing a request. We would have to use the same logic repeatedly for every HTTP request. An app can definitely have several interceptors and each of these deals with the scope of action. While one of the interceptors will cope with authentication, another one with logging, and the third one for error handling and so on. This is possible because of the intelligent way that the angular interceptor for processing the requests.
The capability to process both incoming responses and outgoing requests in the same place opens up many possibilities. The angular framework can be used for setting request headers, and authentic HTTP calls with the help of setting security tokens. It is possible to change the response coming from the HTTP service even before it is used by the code block. This framework can be used to handle global errors in an application. It will also show the progress bar or global spin loader for every HTTP call. It provides a mechanism that is straightforward with the goal to interact with HTTP responses and requests.