When testing a call in Postman with the single header INFO set to blopp, I expected to receive a JWT token with the value passed in as sub. However, when I removed the header, the token contained an empty sub, which was the anticipated outcome.
The script I am running includes sending the headers, but the result of the call shows that the token received has an empty sub. This suggests that there may be an issue with passing in the headers correctly.
const headers = new HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json",
"INFO": "blopp"
});
const options = { headers };
this.http.get<{ token: string }>(url, options)
.subscribe(next => console.log(next.token));
My initial analysis indicates that there might be a problem with how the headers are being passed. It aligns with the behavior observed when deactivating headers in Postman and executing the URL without headers from the browser.
How can I ensure that the value is correctly included as a header in the request? If I am already implementing it correctly, how can I troubleshoot further without backend access (considering it works fine in Postman)?
I have carefully followed best practices related to immutability and have tested various approaches mentioned here. Additionally, I referred to the documentation for guidance.