Skip to content

Commit

Permalink
Merge pull request Kuadrant#358 from pehala/httpx_stability
Browse files Browse the repository at this point in the history
Enhance stability
  • Loading branch information
pehala authored Mar 6, 2024
2 parents db938e0 + 3ad872a commit d90357e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions testsuite/httpx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def __init__(self, retry_codes, response=None, error=None):

def should_backoff(self):
"""True, if the Result can be considered an instability and should be retried"""
return self.has_dns_error() or (self.error is None and self.status_code in self.retry_codes)
return (
self.has_dns_error()
or (self.error is None and self.status_code in self.retry_codes)
or self.has_error("Server disconnected without sending a response.")
)

def has_error(self, error_msg: str) -> bool:
"""True, if the request failed and an error with message was returned"""
Expand All @@ -57,7 +61,7 @@ def __getattr__(self, item):
"""For backwards compatibility"""
if self.response is not None:
return getattr(self.response, item)
raise AttributeError from self.error
raise self.error

def __str__(self):
if self.error is None:
Expand Down

0 comments on commit d90357e

Please sign in to comment.