Skip to content

Set the correct media type for login response and parse the Accept header #801

Open
marmoure wants to merge 1 commit into
developfrom
hotfix/output-media
Open

Set the correct media type for login response and parse the Accept header #801
marmoure wants to merge 1 commit into
developfrom
hotfix/output-media

Conversation

@marmoure
Copy link
Copy Markdown
Contributor

@marmoure marmoure commented May 21, 2026

This PR adds parsing for Accept header and introduces local:accept-json and local:preferred-media-type, it build on top of #800 to fix #253.
These functions allow more robust and future proof way for getting the appropriate header either the preferred one or a specific one.

Also when trying to set the correct headers for the login response using

util:declare-option("output:method", "json"),
util:declare-option("output:medita-type", "application/json"),

I encountered a bug in the RESTServer in writeResultJSON which ignored the output:medita-type option, I added evolvedbinary/elemental#212 for elemental and the same should be done for eXist-db.

In the mean time

response:set-header("Content-Type", "application/json; charset=UTF-8"),

is being used as workaround until this bug is resolved.

@marmoure marmoure force-pushed the hotfix/output-media branch from 19914a1 to bae133a Compare May 21, 2026 17:55
@marmoure marmoure marked this pull request as ready for review May 21, 2026 17:56
Copy link
Copy Markdown
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @marmoure. The Xqdoc is not well-formed.

We don't normally link elemental issues. Feel free to keep it in alongside an exist issue. But both should be properly formatted.

Please add a test. Did you test this against exist? Which version?

@marmoure marmoure force-pushed the hotfix/output-media branch from bae133a to 9fe078a Compare May 22, 2026 09:01
@marmoure
Copy link
Copy Markdown
Contributor Author

Thanks for the @duncdrum I fixed the xqdoc issue, this was tested on eXist-db 6.4.1.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] XML Parsing Error in console

2 participants