This repository was archived by the owner on Sep 4, 2024. It is now read-only.
minreq_http: return an HTTP error on error with no JSON in body#103
Merged
apoelstra merged 1 commit intoapoelstra:masterfrom Jun 28, 2023
Merged
minreq_http: return an HTTP error on error with no JSON in body#103apoelstra merged 1 commit intoapoelstra:masterfrom
apoelstra merged 1 commit intoapoelstra:masterfrom
Conversation
It is useful for downstream users to be matching on errors that do not contain a valid JSONRPC error in the HTTP response body. One instance is if the HTTP server work queue depth is exceeded, as they probably want to retry the request later. On such error we would return a JSON deserialization error, without exposing neither the HTTP status code nor the body of the response. This made it impossible to detect such transient errors. Instead, introduce a new HttpError variant that gets returned when the requested is responded to by an error that does not contain valid JSON in its body.
apoelstra
approved these changes
Jun 28, 2023
This was referenced Jun 29, 2023
Merged
apoelstra
added a commit
that referenced
this pull request
Jun 29, 2023
5b34d4a Bump version to 16.0 (Antoine Poinsot) 223d556 simple_http: gate FromStr usage behind 'proxy' feature (Antoine Poinsot) d57ee9d minreq_http: make Error enum #[non_exhaustive] (Antoine Poinsot) Pull request description: To make #103 and #102 available downstream. Note i've successfully tested #103 in my software (detect and retry requests to bitcoind upon hitting a transient workqueue exceeded error). Updating the Error enum for minreq_http is an API break, so bump the major version. ACKs for top commit: tcharding: ACK 5b34d4a apoelstra: ACK 5b34d4a Tree-SHA512: f19641b39da346d61cf4f4f3c1f47bf39dd81394c26f88043ae92d30124583e74f2d61b465ef42c157e6a93fc757fc6d396aeb716c7d8347a0b48bed5a9924d3
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is useful for downstream users to be matching on errors that do not contain a valid JSONRPC error in the HTTP response body. One instance is if the HTTP server work queue depth is exceeded, as they probably want to retry the request later.
On such error we would return a JSON deserialization error, without exposing neither the HTTP status code nor the body of the response. This made it impossible to detect such transient errors.
Instead, introduce a new HttpError variant that gets returned when the requested is responded to by an error that does not contain valid JSON in its body.
See also: #94 (comment).