You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
base_url property in request_adapter.http_client is not used by HttpXRequestAdapter #374
What are you generating using Kiota, clients or plugins?
API Client/SDK
In what context or format are you using Kiota?
Nuget tool
Client library/SDK language
Python
Describe the bug
AsyncClient.base_url is not used by HttpxRequestAdapter as expected.
http_asyncclient: AsyncClient=AsyncClient(
base_url=self.stimulator_config.server.base_url, # BUG base_url not used, file issue with kiota
),
headers=headers,
)
request_adapter: HttpxRequestAdapter=HttpxRequestAdapter(
authentication_provider=auth_provider,
http_client=http_asyncclient,
# base_url=app_config.server.base_url, # base_url must be set here )client: ApiClient=ApiClient(request_adapter=request_adapter)
Latest Kiota version known to work for scenario above?(Not required)
No response
Known Workarounds
Set base_url in
Configuration
Linux (Ubuntu)
Debug output
Click to expand log
```
</details>
### Other information
We are using microsoft-kiota-http==1.3.3 (HttpxRequestAdapter). I updated to 1.3.4 but the constructor of HttpxRequestAdapter has not changed from what I can see.
See: https://github.com/microsoft/kiota-http-python/blob/main/kiota_http/httpx_request_adapter.py#L90
Activity
baywet commentedon Oct 15, 2024
Hi Jimisola Laursen (@jimisola)
Thank you for using kiota and for reaching out.
You are correct, in dotnet, if a base url is set on the underlying HTTP client, it's used by the request adapter.
https://github.com/microsoft/kiota-dotnet/blob/650812d9b598f192e6e55424e327d2bcee49c99a/src/http/httpClient/HttpClientRequestAdapter.cs#L52
This is something that could be fixed by adding a couple of conditions here
kiota-python/packages/http/httpx/kiota_http/httpx_request_adapter.py
Line 90 in 43bff74
(explicitly passed base URL should take precedence over the one from the underlying http client)
By reading the base url property
https://github.com/encode/httpx/blob/1bf1fc0ea8417c8e539914aeafdb48f15591ba75/httpx/_client.py#L268
Is this something you'd like to submit a pull request for provided some guidance?
jimisola commentedon Oct 16, 2024
Hi Vincent Biret (@baywet)
Thanks for confirming the issue.
The fix is normally the easy thing whereas getting to know the project, i.e. how to build, test, do code formatting etc is usually what takes time.
I can have a look at it but I don't know when due to deadlines at work and some involvement in some other open source projects.
Fix base_url usage in HttpxRequestAdapter
fix: use the httpx client base url when available