crucible icon indicating copy to clipboard operation
crucible copied to clipboard

application/fhir+xml Accept header in JSON tests

Open msfyuksel opened this issue 7 years ago • 6 comments

Hi, I noticed that in all the JSON specific tests I've tried so far, DELETE requests are sent with XML (i.e. "application/fhir+xml") Accept header. Can you please change them to JSON?

In fact, even in more generic resource tests like those for clinical resources, almost all read, create, update operations are done with JSON Accept header; but only the delete operation is done with XML Accept header.

P.S. I first introduced this issue in zulip, but you can ignore it. github is more appropriate for issue reports.

msfyuksel avatar Feb 16 '17 14:02 msfyuksel

Example for us: https://projectcrucible.org/servers/58a31ac66372752300000000#58a58e7863727544da020000/resourcetest_allergyintolerance/X070_AllergyIntolerance

It looks like our intent was to not send a content-type header on DELETE, because we aren't sending any content in the body of the request. In other parts of our code we fall back to xml by default if no content-type header is set though, so it incorrectly substitutes in the xml Content-Type.

I can fix that. Would not being sent a Content-Type header on DELETE work in your system? I think that is what is technically correct.

Thanks for the bug report.

arscan avatar Feb 16 '17 15:02 arscan

Exactly, there is no need to have Content-Type header on DELETE. But it is not only Content-Type, we have a problem with the Accept header in fact.

For example, this is a DELETE request as the last step of the "TS Connectathon 14 Patient Base Server Id Json" test suite.

DELETE /fhir-1-8-0/Patient/2f2ffb4e68e54055898e12f182ac521e HTTP/1.1 Accept: application/fhir+xml Accept-Encoding: gzip, deflate User-Agent: Ruby FHIR Client Content-Type: application/fhir+xml;charset=UTF-8 Accept-Charset: UTF-8 Resource: FHIR::Patient Params: /2f2ffb4e68e54055898e12f182ac521e

All the former CREATE, UPDATE, SEARCH requests in this test suite set both Accept and Content-Type headers as "application/fhir+json", but only the DELETE request use "application/fhir+xml". Maybe the fall-back mechanism in DELETE applies to Accept as well.

Thanks for your immediate response.

msfyuksel avatar Feb 17 '17 07:02 msfyuksel

I made the fix in https://github.com/fhir-crucible/fhir_client/pull/61 and https://github.com/fhir-crucible/fhir_client/pull/62 and deployed the updated version. I'm going to close this, but if you are still seeing the problem for some reason let us know. Thanks for the bug report!

arscan avatar Feb 22 '17 18:02 arscan

Well, unfortunately I still receive xml headers in json tests. The below is again from "TS Connectathon 14 Patient Base Server Id Json" test suite:

DELETE /fhir-1-8-0/Patient/be02f0d5-73b3-412a-be53-d8712b9141e3 HTTP/1.1 Accept: application/fhir+xml Accept-Encoding: gzip, deflate User-Agent: Ruby FHIR Client Content-Type: application/fhir+xml;charset=UTF-8 Accept-Charset: UTF-8 Resource: FHIR::Patient Params: /be02f0d5-73b3-412a-be53-d8712b9141e3

FYI, in the mean time, we have implemented xml support in our server. So, we are actually able to handle this request, but I still think that xml headers should not exist in a json test suite.

Furthermore, all the $validate requests do arrive with xml headers (and xml body) as well in these json tests.

msfyuksel avatar Feb 23 '17 13:02 msfyuksel

Yes, we definitely want to have this fixed, even if you upgraded your server to support xml. Thanks for letting me know it is still behaving incorrectly. I wonder if our deployment this weekend didn't update dependencies to our updated client properly, since both this and the trailing slash in history requests should be have been fixed. I'll see if I can track it down this afternoon.

arscan avatar Feb 23 '17 17:02 arscan

OK, thank you. I am ready to test in the next update.

msfyuksel avatar Feb 24 '17 06:02 msfyuksel