Skip to content
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

Response body encoded as JSON string when function returning a domain representing media type is requested with Accept "*/*" header #3392

Closed
mkleczek opened this issue Apr 9, 2024 · 1 comment

Comments

@mkleczek
Copy link

mkleczek commented Apr 9, 2024

Environment

  • PostgreSQL version: 16
  • PostgREST version: 12.0.2
  • Operating system: Windows

Description of issue

I have the following function:

CREATE DOMAIN "text/javascript" AS text;
CREATE OR REPLACE FUNCTION "module.js"() RETURNS "text/javascript"...

When requested by a browser from:

<script type="module" src="/rpc/module.js"></script>

returned response body is encoded as JSON (ie. line breaks are replaced with \n) so even if - as a workaround for #3391 - I explicitly set content type in the function using current_setting, it is not valid JS code.

@steve-chavez
Copy link
Member

returned response body is encoded as JSON

A consequence of the default handler (*/*) being application/json. This needs the any handler as mentioned on #3387 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants