mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Add static routes for frontend modern and legacy service workers (#120488)
This commit is contained in:
parent
de18be235d
commit
e50802aca3
@ -398,7 +398,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
static_paths_configs: list[StaticPathConfig] = []
|
static_paths_configs: list[StaticPathConfig] = []
|
||||||
|
|
||||||
for path, should_cache in (
|
for path, should_cache in (
|
||||||
("service_worker.js", False),
|
("sw-modern.js", False),
|
||||||
|
("sw-modern.js.map", False),
|
||||||
|
("sw-legacy.js", False),
|
||||||
|
("sw-legacy.js.map", False),
|
||||||
("robots.txt", False),
|
("robots.txt", False),
|
||||||
("onboarding.html", not is_dev),
|
("onboarding.html", not is_dev),
|
||||||
("static", not is_dev),
|
("static", not is_dev),
|
||||||
|
@ -174,9 +174,12 @@ async def test_frontend_and_static(mock_http_client: TestClient) -> None:
|
|||||||
assert "public" in resp.headers.get("cache-control")
|
assert "public" in resp.headers.get("cache-control")
|
||||||
|
|
||||||
|
|
||||||
async def test_dont_cache_service_worker(mock_http_client: TestClient) -> None:
|
@pytest.mark.parametrize("sw_url", ["/sw-modern.js", "/sw-legacy.js"])
|
||||||
|
async def test_dont_cache_service_worker(
|
||||||
|
mock_http_client: TestClient, sw_url: str
|
||||||
|
) -> None:
|
||||||
"""Test that we don't cache the service worker."""
|
"""Test that we don't cache the service worker."""
|
||||||
resp = await mock_http_client.get("/service_worker.js")
|
resp = await mock_http_client.get(sw_url)
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
assert "cache-control" not in resp.headers
|
assert "cache-control" not in resp.headers
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user