I am trying to send some custom HTTP headers so that from client-end so that I can know the cause of the problem and show proper message to user. I am unable to get the response header from the below code (it shows null).
this.myService.getAllUsers().subscribe(results => {
console.log(results)
},
error => {
console.log(error.headers.get("ErrorCode"));
});
But from the browser (chrome) I can see that I have the headers in the response. Look at the image here
I was expecting the see the value "INVALID_SESSION" as the console output.
But getting null instead. Can anyone help?