diff --git a/packages/http/httpx/kiota_http/httpx_request_adapter.py b/packages/http/httpx/kiota_http/httpx_request_adapter.py index e7c3b20..23f1dfa 100644 --- a/packages/http/httpx/kiota_http/httpx_request_adapter.py +++ b/packages/http/httpx/kiota_http/httpx_request_adapter.py @@ -87,9 +87,7 @@ def __init__( if not http_client: http_client = KiotaClientFactory.create_with_default_middleware() self._http_client: httpx.AsyncClient = http_client - if not base_url: - base_url = str(http_client.base_url) if http_client.base_url is not None else "" - self._base_url: str = base_url + self._base_url: str = str(http_client.base_url) if http_client.base_url is not None else "" if not observability_options: observability_options = ObservabilityOptions() self.observability_options = observability_options diff --git a/packages/http/httpx/tests/test_httpx_request_adapter.py b/packages/http/httpx/tests/test_httpx_request_adapter.py index 67c622e..ab3e627 100644 --- a/packages/http/httpx/tests/test_httpx_request_adapter.py +++ b/packages/http/httpx/tests/test_httpx_request_adapter.py @@ -449,8 +449,11 @@ async def test_send_primitive_async_302_with_location_header_does_not_throw( assert "location" in resp.headers await request_adapter.send_primitive_async(request_info, "float", {}) +def test_httpx_request_adapter_ignores_base_url_parameter(auth_provider): + request_adapter = HttpxRequestAdapter(auth_provider, base_url="https://no.com") + assert request_adapter.base_url == "" def test_httpx_request_adapter_uses_http_client_base_url(auth_provider): http_client = httpx.AsyncClient(base_url=BASE_URL) - request_adapter = HttpxRequestAdapter(auth_provider, http_client=http_client) + request_adapter = HttpxRequestAdapter(auth_provider, http_client=http_client, base_url="https://no.com") assert request_adapter.base_url == BASE_URL