Angular HttpClient "Http failure during parsing"
You can specify that the data to be returned is not JSON using responseType
.
In your example, you can use a responseType
string value of text
, like this:
return this.http.post( 'http://10.0.1.19/login', {email, password}, {responseType: 'text'})
The full list of options for responseType
is:
json
(the default)text
arraybuffer
blob
See the docs for more information.
if you have options
return this.http.post(`${this.endpoint}/account/login`,payload, { ...options, responseType: 'text' })
Even adding responseType, I dealt with it for days with no success. Finally I got it.Make sure that in your backend script you don't define header as -("Content-Type: application/json);
Becuase if you turn it to text but backend asks for json, it will return an error...