hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2k stars 1.31k forks source link

If-Match does not specify the weak ETag attribute "W/" #2979

Open Romanow88 opened 3 years ago

Romanow88 commented 3 years ago

When using the generic client for an update, assuming communicating to a versioned server, the "If-Match" header is set to the version of the respource that is being updated, but the required "W/" indicating a weak ETag is omitted. Relevant part of the standard: https://hl7.org/fhir/r4/http.html#versioning

To Reproduce Steps to reproduce the behavior:

  1. Setup a versioned server that has strict "If-Match" handling
  2. Query for a resource using the generic client
  3. Change any part of the resource and try to do an update using the generic client.
  4. Observe server rejecting the update

Expected behavior The client should send a weak ETag (prepended with "W/") as per the standard

Environment (please complete the following information):

Relevant code: https://github.com/hapifhir/hapi-fhir/blob/d1c2d839d187b0820e3c38658a2fef889a908dd3/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/MethodUtil.java#L208

berkant-k commented 1 year ago

I created PR #4129 to solve this issue.

ogg commented 8 months ago

This is still an issue. I currently have to use an IClientInterceptor to rewrite the header.