-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More flexible SQL media type handlers #3037
Comments
@steve-chavez: Thank you for the suggestion. If I could choose, I would favour a solution inside the The easiest from my (perhaps somewhat simplistic) standpoint would be: If a function returns xml, the HTTP response shall be Your solution also works and gives much more flexibility, but has to be configured. |
@fjf2002 Yeah, that could work too. So if there's a custom media type handler it should take precedence over the json handler defined for The only thing that doesn't cover is also handling the |
Yes, that's not critical for me. I must admit one other thing: So feel free to give this issue low priority.
Do you mean with or without any configuration inside Regards, |
Meant inside |
Problem
The SQL handlers introduced on #2825 are not flexible enough to handle multiple media types or the any
*/*
media type. Like the example on https://postgrest.org/en/stable/how-tos/create-soap-endpoint.html, which needs to handletext/xml
,application/soap+xml
and*/*
.Solution
Using the in-db config. Map the handlers in the following way:
{"<table or proc oid>": {"<handler oid>": ["array", "of", "media types" ]}}
Using
oids
like above we ensure the user gets some type checking to prevent errors.Alternatives
pgrst.accept
setting to RPC #1582 (comment), but that seems more complicated to implement and harder to track of (with the above it's all defined in a single place). Additionally the mapping it provides it's global, cannot be scoped to a single function or table handler.The text was updated successfully, but these errors were encountered: