Skip to content

feat: allow injection of httpx client #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

silentworks
Copy link
Contributor

What kind of change does this PR introduce?

Allow developers to supply their own httpx client

What is the current behavior?

Httpx client isn't very configurable and has limited options available for the developer

What is the new behavior?

Httpx client can now be configured by the developer and be supplied to the Postgrest library

Additional context

Add any other context or screenshots.

@silentworks silentworks requested a review from grdsdev as a code owner May 10, 2025 08:40
@coveralls
Copy link

coveralls commented May 10, 2025

Pull Request Test Coverage Report for Build 15039253673

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 19 of 27 (70.37%) changed or added relevant lines in 3 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.4%) to 95.144%

Changes Missing Coverage Covered Lines Changed/Added Lines %
postgrest/_async/client.py 9 13 69.23%
postgrest/_sync/client.py 9 13 69.23%
Files with Coverage Reduction New Missed Lines %
postgrest/_async/client.py 1 86.27%
postgrest/base_request_builder.py 3 88.74%
Totals Coverage Status
Change from base Build 14248123638: -0.4%
Covered Lines: 1783
Relevant Lines: 1874

💛 - Coveralls

) -> AsyncClient:
if http_client is not None:
http_client.base_url = base_url
http_client.headers = headers
Copy link
Contributor

Choose a reason for hiding this comment

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

should also pass timeout, verify, proxy, here?

Copy link
Contributor Author

@silentworks silentworks May 10, 2025

Choose a reason for hiding this comment

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

I didn't pass those as I don't want them to be override the options for httpx client the developer will pass. The only options we need to maintain are the base_url and headers. The others should be manually configured by the developer if they are passing their own httpx client.

Copy link
Contributor

@grdsdev grdsdev May 12, 2025

Choose a reason for hiding this comment

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

got it, let us at least deprecate the usage of the other params in favor of the httpx client as in https://github.com/supabase/functions-py/pull/201/files#r2083278694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants