Skip to content

Commit

Permalink
Fix: connect error text
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyProger1 committed Apr 29, 2024
1 parent 2755fcb commit 93f33af
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions resty/clients/httpx/clients.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from urllib.parse import urljoin

import httpx

Expand All @@ -20,10 +21,10 @@
class RESTClient(BaseRESTClient):

def __init__(
self,
httpx_client: httpx.AsyncClient = None,
check_status: bool = True,
middleware_manager: BaseMiddlewareManager = None,
self,
httpx_client: httpx.AsyncClient = None,
check_status: bool = True,
middleware_manager: BaseMiddlewareManager = None,
):
self.middlewares = middleware_manager or MiddlewareManager()
self._xclient = httpx_client or httpx.AsyncClient()
Expand All @@ -45,7 +46,7 @@ async def _make_xrequest(self, request: Request) -> httpx.Response:
timeout=request.timeout,
)
except httpx.ConnectError:
raise ConnectError(url=request.url)
raise ConnectError(url=urljoin(str(self._xclient.base_url), request.url))

@staticmethod
def _extract_json_data(xresponse: httpx.Response) -> dict | list:
Expand All @@ -57,7 +58,7 @@ def _extract_json_data(xresponse: httpx.Response) -> dict | list:
return data

async def _parse_xresponse(
self, request: Request, xresponse: httpx.Response
self, request: Request, xresponse: httpx.Response
) -> Response:
return Response(
request=request,
Expand Down

0 comments on commit 93f33af

Please sign in to comment.