Skip to content

Fix base_url usage in HttpxRequestAdapter - #459

Merged
Vincent Biret (baywet) merged 5 commits into
microsoft:mainfrom
svrooij:fix-base-url
Jan 28, 2025
Merged

Vincent Biret (baywet) merged 5 commits into
microsoft:mainfrom
svrooij:fix-base-url

Conversation

@svrooij

@svrooij Stephan van Rooij (svrooij) commented Jan 26, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #374

Modify HttpxRequestAdapter to use http_client.base_url if base_url is not explicitly set.

  • Update the constructor in packages/http/httpx/kiota_http/httpx_request_adapter.py to check and use http_client.base_url if base_url is not provided.
  • Update the base_url property to return http_client.base_url if _base_url is not set.
  • Add a test in packages/http/httpx/tests/test_httpx_request_adapter.py to verify that HttpxRequestAdapter uses http_client.base_url if base_url is not explicitly set.

For more details, open the Copilot Workspace session.

Fixes microsoft#374

Modify `HttpxRequestAdapter` to use `http_client.base_url` if `base_url` is not explicitly set.

* Update the constructor in `packages/http/httpx/kiota_http/httpx_request_adapter.py` to check and use `http_client.base_url` if `base_url` is not provided.
* Update the `base_url` property to return `http_client.base_url` if `_base_url` is not set.
* Add a test in `packages/http/httpx/tests/test_httpx_request_adapter.py` to verify that `HttpxRequestAdapter` uses `http_client.base_url` if `base_url` is not explicitly set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/kiota-python/issues/374?shareId=XXXX-XXXX-XXXX-XXXX).
@svrooij
Stephan van Rooij (svrooij) requested a review from a team as a code owner January 26, 2025 13:32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution here Stephan van Rooij (@svrooij)

Any chance you can update the commit message to follow this to help with automation of the changelog/release generation. https://github.com/microsoft/kiota-python/blob/main/CONTRIBUTING.md#commit-message-format

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

For others reading, I took the time to check this property actually exists:
https://github.com/encode/httpx/blob/10b7295922741b91a15751029e6ad3e8e5efb9f3/httpx/_client.py#L295

Comment thread packages/http/httpx/kiota_http/httpx_request_adapter.py Outdated
Comment thread packages/http/httpx/kiota_http/httpx_request_adapter.py Outdated

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

@baywet
Vincent Biret (baywet) enabled auto-merge (squash) January 28, 2025 14:36
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

base_url property in request_adapter.http_client is not used by HttpXRequestAdapter

3 participants