diff --git a/testsuite/httpx/__init__.py b/testsuite/httpx/__init__.py index 58adc191..1e18dfe4 100644 --- a/testsuite/httpx/__init__.py +++ b/testsuite/httpx/__init__.py @@ -5,7 +5,7 @@ from typing import Union import backoff -from httpx import Client, ConnectError +from httpx import Client, ConnectError, RemoteProtocolError from testsuite.certificates import Certificate @@ -58,6 +58,11 @@ def __getattr__(self, item): return getattr(self.response, item) return None + def __str__(self): + if self.error is None: + return f"Result[status_code={self.response.status_code}]" + return f"Result[error={self.error}]" + class KuadrantClient(Client): """Httpx client which retries unstable requests""" @@ -127,7 +132,7 @@ def request( extensions=extensions, ) return Result(self.retry_codes, response=response) - except ConnectError as e: + except (ConnectError, RemoteProtocolError) as e: return Result(self.retry_codes, error=e) def get(self, *args, **kwargs) -> Result: