-
Notifications
You must be signed in to change notification settings - Fork 490
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
Handles invalid header on versioned update #2467
Conversation
@@ -22,7 +22,15 @@ public Task BindModelAsync(ModelBindingContext bindingContext) | |||
WeakETag model = null; | |||
if (!string.IsNullOrWhiteSpace(suppliedWeakETag)) | |||
{ | |||
model = WeakETag.FromWeakETag(suppliedWeakETag); | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this class have unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I am not opposed to adding them in, but here is my thought process on why I left them out: we do have unit tests for ETag conversions in WeakETagTests.cs
, and the integration test I'll add once PR #2457 is merged should ensure that a 400 is returned when an invalid version is passed in by the user.
I also noticed our other binder class (PartialDateTimeBinder.cs
) doesn't have unit tests. Both binder classes only have the BindModelAsync()
method, and I'm not confident that adding unit tests for it would add much value (I could be wrong, though).
Let me know your thoughts!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I just wanted to make sure there was some test coverage for this.
…The latest version of the FHIR Client no longer does this automatically. The change occurred as part of this PR microsoft/fhir-server#2467
* Update packages to latest except Azure Web Job related packages due to backwards compatibility issues. * Update FhirService to explicitly generate the full e-tag on updates. The latest version of the FHIR Client no longer does this automatically. The change occurred as part of this PR microsoft/fhir-server#2467
The PATCH operation seems to be not possible with the policy version-update. The operation returns the following error: 400 - A valid if-match header is required for resource type 'Organization' |
@EXPEkesheth, FYI |
Description
When the versioning policy is set to "versioned-update", we require that the most recent version of the resource is provided in the request's
if-match
header on an update. The specified version must be in ETag format.Previously, a 500 would be returned if the version was invalid or in an incorrect format. This PR instead returns a 400 Bad Request.
Related issues
Addresses AB#87737.
Testing
Updated the manual test flow to include this case.
A lot of the versioning policy test setup was done in #2457. An automated test for this scenario will be added once that PR merges and this branch can be rebased with those changes.
FHIR Team Checklist
Semver Change (docs)
None (bug fix)