DEV Community

Deepa Chaurasia
Deepa Chaurasia

Posted on

Request and Response Interceptors in JS

Interceptors work as a wall between client and server.

Whenever a request is sent from client to server we can do all kind of processing like changing header,or any operation that can be done in interceptor.

After that interceptor will carry forward the request to the server

Similarly in response interceptor we can check whether the server is sending right response,will check status code if user is authorized or not and then we can do different type of actions as per our requirement and return back those response to client

Top comments (1)

Collapse
 
nima_lalaj profile image
yasin cengiz

Thank you for it, so helpful...