
Prior behavior for HttpClient was to parse the body as JSON when responseType was set to 'json', even if the response was unsuccessful. This changed due to a recent bugfix, and unsuccessful responses had their bodies treated as strings. There is no guarantee that if a service returns JSON in the successful case that it will do so for errors. However, users indicate that most APIs in the wild do work this way. Therefore, this commit changes the error case behavior to attempt a JSON parsing of the response body, and falls back on returning it as a string if that fails. PR Close #19773
Safari (7+), iOS (7+), Edge (14) and IE mobile (11) are tested on BrowserStack.
Angular
Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScript and other languages.
Quickstart
Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.
Description
Languages
TypeScript
86.3%
JavaScript
8.5%
HTML
1.8%
Starlark
1.7%
CSS
1%
Other
0.6%