Authenticated GET on a container returns Turtle body with application/ld+json content-type, ignoring Accept · Issue #325 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
With --conneg enabled, an authenticated GET on a container returns a Turtle body but labels the response Content-Type: application/ld+json, regardless of the requested Accept. The same request without auth correctly returns JSON-LD. This breaks any client that trusts either the Accept negotiation or the Content-Type header (which is most of them).
The body is plainly Turtle, the header says JSON-LD. Even when I request Accept: application/ld+json explicitly (no Turtle in the Accept at all), the auth path still serves Turtle.
Expected
Either:
Body matches Accept — auth path honors the same q-weighted negotiation as the anonymous path. Default to JSON-LD (the documented native format) when client prefers it.
Header matches body — at minimum, the Content-Type label should reflect what's actually in the body.
Probably both. JSON-LD is JSS's native format; Turtle should only come back when the client asks for it.
Why it matters
Clients that do if (contentType.includes('json')) JSON.parse(body) get a parse error on perfectly conformant requests. The mislabel is the worst part — a sniff (e.g. "first non-whitespace char is { or @") can route around it, but every consumer shouldn't have to.
Environment
jss 0.0.155 (latest published)
node v24.5.0
Linux x86_64
Likely a divergence between two response paths inside the auth middleware vs. the anonymous handler. Happy to look at the conneg layer if you want a PR.
Activity
Merge pull request #326 from JavaScriptSolidServer/issue-325-conneg-q…
Respect q-weights and align HEAD/GET content-type for conneg (JavaScr…
Phase 1: embed JSON-LD data island in mashlib HTML wrapper (#7) (#343)
conneg: GET on container with index.html returns HTML to browsers (#409)
review: hoist EXPLICIT_JSON_RE + add HEAD/GET parity tests (#409)
conneg: GET on container with index.html returns HTML to browsers (#409…
fix(conneg): HEAD mirrors GET's negotiated content type for files — c…