-
-
Notifications
You must be signed in to change notification settings - Fork 174
Allow customizing RPC request method #215
Conversation
Thanks for the PR! Somehow I forgot to support For postgrest-js/src/lib/PostgrestQueryBuilder.ts Lines 22 to 31 in 5e332bf
Looking at the docs, it doesn't seem like there's anything GET does that POST can't do, and sending params as request body is cleaner (URL has length limit and all that), so supporting GET probably isn't necessary.
|
One case I could think of (although certainly niche) is that service workers are unable to cache POST requests. |
Hmm yeah, I don't have anything against it but maybe best to leave it out until there's a feature request for it. |
@soedirgo updated! I guess it's good to avoid unnecessary complexity until it's really required, and this does have more consistency with |
Should I send a corresponding PR to integrate this into |
🎉 This PR is included in version 0.34.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Yes please, that'd be rad 🙏 |
What kind of change does this PR introduce?
Feature.
What is the current behavior?
RPC function calls are made only using
POST
.What is the new behavior?
Users can customize the HTTP request type to
GET
orHEAD
. This allows for selecting the count of rows in a function call returning a table without selecting any data with theHEAD
request type andcount
option.Implementation Notes
Object.entries
, but if there's any browser compatibility requirements I can just revert to afor
-in
loop.tsconfig.json
to recognize newer ES methodsGET
/HEAD
request. Seems like there are two possible usages of this: https://postgrest.org/en/v8.0/api.html#calling-functions-with-array-parameters and https://postgrest.org/en/v8.0/api.html#calling-variadic-functions and I'm not sure behaviour which to prefer.