Skip to content

Instance reads (GET /{type}/{id}) ignore Accept: application/fhir+xml and return JSON; search honors it #245

@jmandel

Description

@jmandel

Summary

A FHIR instance read (GET /{type}/{id}) ignores Accept: application/fhir+xml and returns JSON, even though the server does serve XML — a search (?url=…) for the same resource correctly returns XML. So content negotiation is honored on search but silently dropped on instance reads.

Repro (live)

# instance read — asks for XML, gets JSON
curl -s -o /dev/null -w 'instance  -> %{http_code} %{content_type}\n' \
  -H 'Accept: application/fhir+xml' 'https://tx.fhir.org/r4/CodeSystem/v3-ActCode'
# => 200 application/fhir+json   (BUG)

# search — asks for XML, gets XML
curl -s -o /dev/null -w 'search    -> %{http_code} %{content_type}\n' \
  -H 'Accept: application/fhir+xml' 'https://tx.fhir.org/r4/CodeSystem?url=http://terminology.hl7.org/CodeSystem/v3-ActCode'
# => 200 application/fhir+xml    (correct)

(Same on ConceptMap/{id}. ValueSet/$expand and the search paths honor XML; instance reads do not.)

Expected

Per http.html content negotiation, the server SHALL return the requested representation (or 406 Not Acceptable if it cannot) — not silently switch to JSON. Since search already returns XML, instance reads should too.


Confirmed live against https://tx.fhir.org on 2026-06-06 (software FHIRsmith 0.9.6). Source line refs are from the published main branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions