Use immutable cache for HTML5 assets
This commit is contained in:
@@ -396,20 +396,26 @@ def test_html5_server_rendered_project_editor(tmp_path: Path):
|
||||
htmx_asset = client.get("/html5/assets/htmx.min.js")
|
||||
assert htmx_asset.status_code == 200
|
||||
assert "javascript" in htmx_asset.headers["content-type"]
|
||||
assert htmx_asset.headers["cache-control"] == "public, max-age=86400"
|
||||
assert htmx_asset.headers["cache-control"] == "public, max-age=31536000, immutable"
|
||||
assert htmx_asset.headers["x-content-type-options"] == "nosniff"
|
||||
assert "htmx" in htmx_asset.text
|
||||
sse_asset = client.get("/html5/assets/htmx-ext-sse.js")
|
||||
assert sse_asset.status_code == 200
|
||||
assert "javascript" in sse_asset.headers["content-type"]
|
||||
assert sse_asset.headers["cache-control"] == "public, max-age=86400"
|
||||
assert sse_asset.headers["cache-control"] == "public, max-age=31536000, immutable"
|
||||
assert sse_asset.headers["x-content-type-options"] == "nosniff"
|
||||
assert "sse" in sse_asset.text
|
||||
css_asset = client.get("/html5/assets/html5.css")
|
||||
assert css_asset.status_code == 200
|
||||
assert "text/css" in css_asset.headers["content-type"]
|
||||
assert css_asset.headers["cache-control"] == "public, max-age=86400"
|
||||
assert css_asset.headers["cache-control"] == "public, max-age=31536000, immutable"
|
||||
assert css_asset.headers["x-content-type-options"] == "nosniff"
|
||||
assert css_asset.headers["etag"]
|
||||
cached_css_asset = client.get("/html5/assets/html5.css", headers={"If-None-Match": css_asset.headers["etag"]})
|
||||
assert cached_css_asset.status_code == 304
|
||||
assert cached_css_asset.headers["cache-control"] == "public, max-age=31536000, immutable"
|
||||
assert cached_css_asset.headers["x-content-type-options"] == "nosniff"
|
||||
assert cached_css_asset.content == b""
|
||||
assert ".workspace" in css_asset.text
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user