Repository navigation
Raise API exceptions for empty HTTP error responses - #124
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Responseonly checks HTTP status inside the branch that parses a nonempty response body. An empty 400/401/429/500/503 response therefore returns normally despite the constructor's documented non-2XX exception contract.Move the existing status-validation
finallyoutside the conditional body parsing. Preserve the existing status-error precedence over JSON parsing errors and all diagnostic fields. Empty successful responses remain valid.Validation: five empty-error status cases fail before the fix; whitespace-error and empty-success controls retain their behavior. A further regression invokes real
Client.track()with a mocked Requests session and verifies an empty 503 propagates asApiException. All 86 unit tests pass. Full Black, isort, Flake8, MyPy (11 files), andgit diff --checkpass. No live fraud events, credentials, integration app, or full Python matrix were used.