I'm trying to make a simple HTTP function call through TypeScript (Angular) to an API hosted as a function in Azure.
When I call the URL through Postman or directly in the browser, everything works perfectly.
However, when I try to call the URL using http.get
like this:
this.http.get<any>(myUrl)
.subscribe({
next: data => {
console.log(data);
},
error: error => {
console.error('There was an error!', error);
}});
I always end up in the error part with an "Unknown Error."
Strangely, when I check the browser's (Chrome) network tools, the request was successfully sent with a 200 status code and the response contains exactly what I expected.
So, why is the error part of the code being triggered instead of the success part?