I am missing http headers in a response from my HttpInterceptor. I can get a body but not headers. Please see attached output and my code.
@Injectable()
export class ApiVersionInterceptor implements HttpInterceptor {
intercept(
req: import("@angular/common/http").HttpRequest<any>,
next: import("@angular/common/http").HttpHandler
): import("rxjs").Observable<import("@angular/common/http").HttpEvent<any>> {
return next.handle(req).pipe(
tap(httpEvent=>{
// Skip request
if(httpEvent.type === 0){
return;
}
console.log("response: ", httpEvent);
})
);
}
}
Wohoo I fixed my problem.
It is not Angular problem but server problem. I need to add another header:
"access-control-expose-headers": "mintargetapiversion"
Angular ignores custom headers if they are not specified in "access-control-expose-header"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With