I have a post
method using Angular's HttpClient
.
I'm trying to subscribe to the response so I can do a few things after but I'm getting this error:
Error: Uncaught (in promise): HttpErrorResponse: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":200,"statusText":"OK","url":"XXXXXXX","ok":false,"name":"HttpErrorResponse","message":"Http failure during parsing for XXXXXXXX","error":{"error":{},"text":"OK"}}
I've seen somewhere that this could be because it's not a valid JSON response, when I test it on Postman, I get a OK but not as JSON.
My question is, how do I work around this? Is there a way for me to convert this to JSON?
My method looks like:
submitInfo() {
this.http.post(url, data).toPromise()
.then(
(response: Response) => {
console.log(response);
}
));
}