postgrest icon indicating copy to clipboard operation
postgrest copied to clipboard

OPTIONS doesn't work for RPC - disable GET/HEAD on functions according to volatility

Open steve-chavez opened this issue 4 years ago • 0 comments

This happens currently:

OPTIONS /rpc/func_name

HTTP/1.1 405 Method Not Allowed
{"message":"Bad Request"}

Considering the Allow RFC, we should respond with an Allow: GET, POST header depending on the function volatility — fail with 405 for a GET on a VOLATILE function.

This would prevent confusion regarding GET on RPC, see this so question.

(Previously discussed on https://github.com/PostgREST/postgrest/pull/1824#discussion_r616845230)


OPTIONS is now accepted on RPC: https://github.com/PostgREST/postgrest/pull/2378

However we're still missing rejecting a non-VOLATILE function GET. This requires some refactoring of the ApiRequest types.

steve-chavez avatar Apr 20 '21 17:04 steve-chavez