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 Content-Type vs actual content type #837

Closed
johngrimes opened this Issue Jan 25, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@johngrimes

johngrimes commented Jan 25, 2018

This is the behaviour that I observe with a GET on the ID of a STU3 resource, e.g. http://fhirtest.uhn.ca/baseDstu3/Medication/247168:

  1. No Accept header -> Content-Type: application/fhir+json
  2. Accept: application/fhir+json -> Content-Type: application/fhir+json
  3. Accept: application/json+fhir -> Content-Type: application/json+fhir
  4. Accept: application/json -> Content-Type: application/json+fhir
  5. Accept: application/fhir+json,application/json -> Content-Type: application/json+fhir
  6. Accept: application/json,application/fhir+json -> Content-Type: application/fhir+json
  7. Accept: application/fhir+json,application/json;q=0.9 -> Content-Type: application/fhir+json

Considering that the resource I am requesting is a STU3 resource, why does it respond with application/json+fhir in any of these cases?

I think it's probably OK to be tolerant of all the combinations, but why not call the response what it is: application/fhir+json?

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Jan 26, 2018

This pattern of responses is kind of a careful balance between complying to the FHIR spec, and being tolerant of clients that aren't fully compliant (i.e. postel's law).

The application/json+fhir mimetype was the official FHIR mimetype up until the release of DSTU3, so we have tried to be friendly to clients expecting the old mimetype by returning the same when it is requested.

Are any of these causing issues for you? If this logic is causing problems I'm certainly happy to try and address them..

I suppose this one would probably be the best candidate for changing, since the client isn't explicitly requesting the legacy mimetype.

Accept: application/json -> Content-Type: application/json+fhir

jamesagnew added a commit that referenced this issue Jan 26, 2018

@johngrimes

This comment has been minimized.

johngrimes commented Jan 28, 2018

Thanks for the explanation, I can understand returning the old MIME type to clients that have requested it, some of whom may be intolerant of receiving anything else.

I think the two that could be improved are 4 and 5. These currently return the old MIME type, even though the client has not requested it.

I think there is a case for changing these to return a Content-Type of application/fhir+json when responding with a STU3 resource.

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