mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Avoid compressing application (tarfile) downloads from supervisor (#110224)
This commit is contained in:
parent
a0b185d06d
commit
d6fac87876
@ -224,4 +224,10 @@ def should_compress(content_type: str) -> bool:
|
||||
"""Return if we should compress a response."""
|
||||
if content_type.startswith("image/"):
|
||||
return "svg" in content_type
|
||||
if content_type.startswith("application/"):
|
||||
return (
|
||||
"json" in content_type
|
||||
or "xml" in content_type
|
||||
or "javascript" in content_type
|
||||
)
|
||||
return not content_type.startswith(("video/", "audio/", "font/"))
|
||||
|
@ -368,7 +368,7 @@ async def test_ingress_request_get_compressed(
|
||||
aioclient_mock.get(
|
||||
f"http://127.0.0.1/ingress/{build_type[0]}/{build_type[1]}",
|
||||
text=body,
|
||||
headers={"Content-Length": len(body)},
|
||||
headers={"Content-Length": len(body), "Content-Type": "text/plain"},
|
||||
)
|
||||
|
||||
resp = await hassio_noauth_client.get(
|
||||
@ -403,6 +403,7 @@ async def test_ingress_request_get_compressed(
|
||||
"image/jpeg",
|
||||
"font/woff2",
|
||||
"video/mp4",
|
||||
"application/tar",
|
||||
],
|
||||
)
|
||||
async def test_ingress_request_not_compressed(
|
||||
@ -458,6 +459,7 @@ async def test_ingress_request_with_charset_in_content_type(
|
||||
"text/html",
|
||||
"application/javascript",
|
||||
"text/plain",
|
||||
"application/json",
|
||||
],
|
||||
)
|
||||
async def test_ingress_request_compressed(
|
||||
|
Loading…
x
Reference in New Issue
Block a user