Skip to content

Content-type not set when function returning a domain representing media type is requested with Accept "*/*" header #3391

@mkleczek

Description

@mkleczek

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 Content-Type is application/json

It seems the browser is setting Accept header to */* and PostgREST does not set proper content type in this case.
As a workaround it is necessary to explicitly set content type in the function using current_setting.

Metadata

Metadata

Assignees

Labels

difficulty: mediumHaskell task involving PostgreSQL IO

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions