You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some external services have webhooks that allow to POST json to an URL. This json doesn't come with a top level key, so our Prefer: params=single-object header is ideal here.
However, some services(like Postmark) don't allow setting HTTP headers for these webhooks. The workaround here is to use the proxy to map an URL query parameter to the header, but this is not convenient.
(Also, I can't find it right now, but there was an issue/gitter comment about an embedded device having the same limitation - crippled http client)
Proposal
Allow a function with single unnamed parameter to be called with POST, without specifying params=single-object:
create or replacefunctionbulk_email_processing(json) returns void as $_$
-- ...
$_$ language sql;
POST /rpc/bulk_email_processing
{"any": "json"}
This wouldn't work for GET, since the parameter is unnamed it can't be specified in the URL.
Right now we don't allow calling unnamed parameters on functions, so this wouldn't cause a breaking change.
The text was updated successfully, but these errors were encountered:
steve-chavez
added
the
idea
Needs of discussion to become an enhancement, not ready for implementation
label
Jan 20, 2021
steve-chavez
changed the title
RPC: allow a function with single unnamed parameter to be called with POST
Allow a function with single unnamed parameter to be called with POST
Jan 20, 2021
Sounds good. jsonb should be supported as well, I think. How about generalizing this to text and bytea, too? This would allow us to post any type of body.
Sounds good. jsonb should be supported as well, I think. How about generalizing this to text and bytea, too?
Yes, great idea! This would also allow us to upload raw binary(#922). I think the lack of multipart could be worked around by adding data on the headers.
steve-chavez
added
enhancement
a feature, ready for implementation
and removed
idea
Needs of discussion to become an enhancement, not ready for implementation
labels
Jan 21, 2021
Use case
Some external services have webhooks that allow to POST json to an URL. This json doesn't come with a top level key, so our Prefer: params=single-object header is ideal here.
However, some services(like Postmark) don't allow setting HTTP headers for these webhooks. The workaround here is to use the proxy to map an URL query parameter to the header, but this is not convenient.
(Also, I can't find it right now, but there was an issue/gitter comment about an embedded device having the same limitation - crippled http client)
Proposal
Allow a function with single unnamed parameter to be called with POST, without specifying
params=single-object
:This wouldn't work for GET, since the parameter is unnamed it can't be specified in the URL.
Right now we don't allow calling unnamed parameters on functions, so this wouldn't cause a breaking change.
The text was updated successfully, but these errors were encountered: