-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of non-JSON errors.
When getting a non-200 HTTP response, orderly tries to decode the body as JSON in order to extract the error message. We do however occasionally get errors that aren't JSON formatted, in particular if the error is generated by nginx rather than Packit. This situation can arise if the Packit server is down (a 503 error), or if nginx rejects the request due to the body being too large (a 413 error). We can use the content type header of the response to determine whether it is safe to decode the body as JSON. If the response is not of the expected mime-type, the body is ignored and a generic error based on the status code alone is returned.
- Loading branch information
Showing
3 changed files
with
26 additions
and
10 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