This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($http): throw more informative error on invalid JSON response
- Loading branch information
Showing
3 changed files
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@ngdoc error | ||
@name $http:baddata | ||
@fullName Bad JSON Data | ||
@description | ||
|
||
The default @{link ng.$http#default-transformations `transformResponse`} will try to parse the | ||
response as JSON if the `Content-Type` header is `application/json` or the response looks like a | ||
valid JSON-stringified object or array. | ||
This error occurs when that data is not a valid JSON object. | ||
|
||
The error message should provide additional context such as the actual response. | ||
|
||
To resolve this error, make sure you pass valid JSON data to `transformResponse` or use an | ||
appropriate `Content-Type` header for non-JSON data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters