ACC-2584: fix If-Match and If-None-Match validation for GET on entity item and to-one relation endpoints#226
Conversation
291e135 to
6c76f7d
Compare
...rest/src/test/java/com/contentgrid/appserver/rest/VersionConstraintArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
| var request = (HttpServletRequest) webRequest.getNativeRequest(); | ||
|
|
||
| List<VersionConstraint> notMatching = List.of(); | ||
| if (!isSafeMethod(request.getMethod())) { |
There was a problem hiding this comment.
Hmm, I'm not sure how I feel about conditionally ignoring the If-None-Match header here.
If it's not combined with the explicit check in the body, the requested version check is not performed, and that's not really obvious from the code in the controller.
Did you take a look at the content controller code?
There is first a check done with WebRequest#checkNotModified(); and then a VersionConstraint check after it. Moving that into an utility method that is called from the 3 places might be nicer?
fa10a5e to
6760ac1
Compare
...ntgrid-appserver-rest/src/main/java/com/contentgrid/appserver/rest/EntityRestController.java
Outdated
Show resolved
Hide resolved
...server-rest/src/main/java/com/contentgrid/appserver/rest/property/ContentRestController.java
Outdated
Show resolved
Hide resolved
|
|
||
| /** | ||
| * Verifies whether the version is satisfied by the versionConstraint. Returns true | ||
| * when the response is 304 Not Modified, false when the response is 200 Ok. |
There was a problem hiding this comment.
I think this javadoc should be slightly more like the javadoc of webRequest.checkNotModified(). The way it's phrased here makes it sound like the response has already happened.
Checks whether the requested entity's version matches the versionConstraint.
Returns true when it matches, false when the entity is newer. This will also
set the webRequest's HTTP response status to 304 and 200, respectively.
This reverts commit b13a0b0.
|



this breaks behavior of If-None-Match on entity item requests (it was not supported on relation requests).Fixed in this PR as well.