I am writing an API GET request using HttpClient.get()
. I pass in the option to observe the response, and when I access the .keys()
, I do not get any other headers besides Content-Type
.
Access-Control-Allow-Origin
header is set to a wild card (*) and still I can only access the Content-Type
header in angular. What am I missing?
The header is correctly being sent to my browser in the networking tab. I also tried explicitly allowing that custom header in Access-Control-Allow-Origin
.
Angular App:
this.data.getClubs(1, 10, '', {clubName: 'asc'}, '').subscribe(
dataJson => {
console.log(dataJson.headers.keys());
}
getClubs(page: number, count: number, group: any, sorting: any, filter: any) {
return this.http.get(this.apiUrl + `/club`, {
params: {
count: String(count),
filter: String(filter),
group: String(group),
page: String(page),
sorting: JSON.stringify(sorting)
},
headers: this.getHttpOptions().headers,
observe: 'response'
});
}
Please view images. The header is set to allow access to the header. https://i.stack.imgur.com/Q6sk6.png https://i.stack.imgur.com/hAVHV.png
Any help would be appreciated!