Skip to content

Commit 727f3f0

Browse files
committed
use etag instead of modified header
1 parent a936c86 commit 727f3f0

File tree

1 file changed

+3
-3
lines changed
  • src/py/reactpy/reactpy/backend

1 file changed

+3
-3
lines changed

src/py/reactpy/reactpy/backend/asgi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ async def file_response(scope, send, file_path: Path) -> None:
275275
return
276276

277277
# Check if the file is already cached by the client
278-
modified_since = await get_val_from_header(scope, b"if-modified-since")
279-
if modified_since and modified_since > await asyncio.to_thread(
278+
etag = await get_val_from_header(scope, b"ETag")
279+
if etag and etag != await asyncio.to_thread(
280280
os.path.getmtime, file_path
281281
):
282282
await simple_response(send, 304, "Not modified.")
@@ -303,7 +303,7 @@ async def file_response(scope, send, file_path: Path) -> None:
303303
"headers": [
304304
(b"content-type", mime_type.encode()),
305305
(
306-
b"last-modified",
306+
b"ETag",
307307
str(
308308
await asyncio.to_thread(os.path.getmtime, file_path)
309309
).encode(),

0 commit comments

Comments
 (0)