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

Conversation

abhishekg999
Copy link
Contributor

What kind of change does this PR introduce?

Allows using GET and HEAD methods on Postgrest RPC functions with arguments.

What is the current behavior?

RPC functions always try to send params in the body. This will fail for GET and HEAD methods.

Please link any relevant issues here.

#592

What is the new behavior?

You can now properly use get=True / head=True in postgrest RPC func calls.

@abhishekg999 abhishekg999 requested a review from grdsdev as a code owner May 10, 2025 21:01
@abhishekg999 abhishekg999 changed the title fix: pass params as query params for get/head requests (#592) fix: pass params as query params for get/head requests May 10, 2025
@coveralls
Copy link

coveralls commented May 12, 2025

Pull Request Test Coverage Report for Build 14993454641

Details

  • 20 of 21 (95.24%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.006%) to 95.506%

Changes Missing Coverage Covered Lines Changed/Added Lines %
postgrest/_async/client.py 1 2 50.0%
Totals Coverage Status
Change from base Build 14248123638: -0.006%
Covered Lines: 1764
Relevant Lines: 1847

💛 - Coveralls

@grdsdev
Copy link
Contributor

grdsdev commented May 12, 2025

Hi @abhishekg999 thank you for this fix.

Can you also add a test for asserting the behavior?

Thanks.

@abhishekg999
Copy link
Contributor Author

abhishekg999 commented May 13, 2025

@grdsdev TY, also noticed BaseRPCRequestBuilder also doesnt merge the prefer header. I made an update to that to match the behavior in postgrest-js.

@@ -660,7 +660,11 @@ def select(
"""
method, params, headers, json = pre_select(*columns, count=None)
self.params = self.params.add("select", params.get("select"))
self.headers["Prefer"] = "return=representation"
if self.headers.get("prefer"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is headers in python case-insensitive? This line is checking for prefer, and the line below for Prefer.

Copy link
Contributor Author

@abhishekg999 abhishekg999 May 13, 2025

Choose a reason for hiding this comment

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

Actually it should both normalize to lowercase,I just did that to match the get("select") in the line above, but I like keeping it uppercase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is case-insensitive*

Copy link
Contributor

@grdsdev grdsdev left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the contribution @abhishekg999

@grdsdev grdsdev merged commit 576a5b8 into supabase:main May 13, 2025
9 checks passed
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