-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix): improve status handling in API Domain
Properly handle cases where a non-200 status code is returned and the status text is in the response body - otherwise basically any error would end up in the body as a string (thanks, http/2) and result in an unmarshalling error. Changes: - added a "status" field, which is populated with the http.Status if included in the response, or the text from the http.StatusCode if not. - don't error on a 404 (I swear I did that already, so I guess I did it for reals this time) - don't try to unmarshal the body into a json object if the return isn't a 2XX I'm sure I'm missing more edge cases, and welcome any suggestions, but hopefully this is better!
- Loading branch information
1 parent
3219c19
commit 250bf50
Showing
3 changed files
with
36 additions
and
21 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
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