mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Protect our user agent (#51486)
* Protect our user agent * Fix expected error
This commit is contained in:
@@ -195,3 +195,14 @@ async def test_async_aiohttp_proxy_stream_client_err(aioclient_mock, camera_clie
|
||||
|
||||
resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test")
|
||||
assert resp.status == 502
|
||||
|
||||
|
||||
async def test_client_session_immutable_headers(hass):
|
||||
"""Test we can't mutate headers."""
|
||||
session = client.async_get_clientsession(hass)
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
session.headers["user-agent"] = "bla"
|
||||
|
||||
with pytest.raises(AttributeError):
|
||||
session.headers.update({"user-agent": "bla"})
|
||||
|
||||
Reference in New Issue
Block a user