From a42d83c9f64c5b4b0deca52b35a9e46013c82364 Mon Sep 17 00:00:00 2001 From: emma Date: Mon, 10 Mar 2025 13:58:41 -0400 Subject: [PATCH] add content-length and etag headers to thumbnail endpoint --- backend/btrixcloud/colls.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/btrixcloud/colls.py b/backend/btrixcloud/colls.py index a475328b..40a22ef9 100644 --- a/backend/btrixcloud/colls.py +++ b/backend/btrixcloud/colls.py @@ -433,7 +433,11 @@ class CollectionOps: async for chunk in resp.content.iter_chunked(4096): yield chunk - headers = {"Cache-Control": "max-age=3600, stale-while-revalidate=86400"} + headers = { + "Cache-Control": "max-age=3600, stale-while-revalidate=86400", + "Content-Length": f"{image_file.size}", + "Etag": f'"{image_file.hash}"', + } return StreamingResponse(reader(), media_type=image_file.mime, headers=headers) async def list_collections(