Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

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 15650813752

Details

  • 88 of 90 (97.78%) changed or added relevant lines in 11 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 96.15%

Changes Missing Coverage Covered Lines Changed/Added Lines %
postgrest/_async/client.py 15 16 93.75%
postgrest/_sync/client.py 15 16 93.75%
Totals Coverage Status
Change from base Build 15569726630: 0.07%
Covered Lines: 1898
Relevant Lines: 1974

💛 - Coveralls

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

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

@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

@silentworks silentworks requested a review from grdsdev June 11, 2025 09:24
@grdsdev
Copy link

grdsdev commented Jun 11, 2025

@silentworks can you add at least one test case that uses a custom httpx instance?

@silentworks silentworks force-pushed the silentworks/httpx-dependency-injection branch from 6b027b9 to 4506be3 Compare June 14, 2025 09:50
@silentworks silentworks merged commit 635a4ba into main Jun 14, 2025
10 checks passed
@silentworks silentworks deleted the silentworks/httpx-dependency-injection branch June 14, 2025 11:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants