Can you find out how to retrieve the status codes for all requests using the HttpClient
method?
callingAPI() {
let headers = new HttpHeaders();
headers = headers.append('Content-Type', 'application/json');
headers = headers.append('Authorization', `Bearer ${this.token}`);
this.http.post("URL",
{
"dataToSend": "data"
}, {
headers: headers
}).subscribe(response => {
console.log(response);
},
(error: HttpErrorResponse) => {
if (error.status === 403) {
console.log("Caught 403 status code");
}
}
)
}
Is there a way to determine the status code of an HTTP request that returns 202, 200, or other statuses?