mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-30 05:25:06 +02:00
⚡️(backend) implement etag and last_modified headers to fetch content
We want to give to the js client the ability to use some headers to avoid fetching a content it already have. For this, the content endpoint will return an ETag and Last-Modified headers corresponding to the file content ETag and its last modification. For future fetch, the client can use the If-None-Match or If-Modified-Since request headers, if one of these headers are satisfied, the endpoint will return a 304 response. If not it will still return a 200
This commit is contained in:
@@ -194,3 +194,8 @@ class AIUserRateThrottle(AIBaseRateThrottle):
|
||||
if x_forwarded_for
|
||||
else request.META.get("REMOTE_ADDR")
|
||||
)
|
||||
|
||||
|
||||
def get_content_metadata_cache_key(document_id):
|
||||
"""Return the cache key used to store content metadata."""
|
||||
return f"docs:content-metadata:{document_id!s}"
|
||||
|
||||
Reference in New Issue
Block a user