concrete-datastore
concrete-datastore copied to clipboard
Feature : mechanism to avoid mid-air edit collisions
In order to avoid mid-air edit collisions, GET responses on an instance should include an ETag header with as value the last_modification_date of this instance.
When attempting a PATCH request on an instance, the request should include the If-Match header with as value the ETag value retrieved from the API (i.e the last_modification_date of the instance):
- If a
PATCHrequest does not include aIf-Matchheader: update the instance anyways. - Otherwise:
- if the
If-Matchmatches with thelast_modification_dateof the instance to update, allow the request to update the instance. - if it does not match, return a
HTTP 409 CONFLICTresponse.
- if the
Useful sources:
- ETags: https://devdocs.io/http/headers/etag
- Django Middelware: https://docs.djangoproject.com/fr/2.2/ref/middleware/#django.middleware.http.ConditionalGetMiddleware