I want to modify the response body through HttpInterceptor. When I catch the casuistic of HttpResponse, I make a clone of the response and modify the body:
return next.handle(req).pipe(
map(resp => {
if( resp instanceof HttpResponse) {
const falseResp = resp.clone({body:null});
return falseResp;
}
return resp;
})
)
falseResp contains body:null.
But the response received by the browser shows the original response.
I'm very confused about it.
Thanks.
I want to modify the response body before the browser receives it.
there are 2 times to understand this. First, when the backend request is complete and some service response with, usually, a json. Second, when you want modify the response. The browser always show you json data clean, I mean, before that you manipulate the data.