I'm having trouble reading the custom response headers from Angular. My Angular code looks like this,
testBackEndResponse() {
return this.http.post(
"backendApiUrl",
null,
{ observe: 'response', responseType: 'text' }
);
}
Reading the response
this.service
.testBackEndResponse()
.pipe(takeUntil(this.destroy$))
.subscribe((resp) => {
const keys = resp.headers.get('authorization');
});
Backend Node Azure Function Code
const httpTrigger: AzureFunction = async function (
context: Context, req: HttpRequest ): Promise { var params = req.params;
context.res.status = 200;
context.res.headers = {
"Access-Control-Expose-Headers":
"authorization",
"Access-Control-Allow-Origin": "*",
"authorization": "test token"
};
};
Even after exposing I still get "Content-Type" header only to the angular. Any reason?