Skip to content

Commit

Permalink
bugfix injected headers
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Dec 23, 2024
1 parent 0933f66 commit 660bede
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/evohomeasync/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def __init__(
async def _headers(self, headers: dict[str, str] | None = None) -> dict[str, str]:
"""Ensure the authorization header has a valid session id."""

return (headers or HEADERS_BASE) | {
headers = HEADERS_BASE | (headers or {})
return headers | {
"sessionId": await self._get_session_id(),
}
3 changes: 2 additions & 1 deletion src/evohomeasync2/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def __init__(
async def _headers(self, headers: dict[str, str] | None = None) -> dict[str, str]:
"""Ensure the authorization header has a valid access token."""

return (headers or HEADERS_BASE) | {
headers = HEADERS_BASE | (headers or {})
return headers | {
"Authorization": "bearer " + await self._get_access_token(),
}
2 changes: 2 additions & 0 deletions tests/tests_rf/test_v2_urlz.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ async def test_tcs_urls(
json={"SystemMode": "Auto", "Permanent": True},
) # type: ignore[assignment]

# factory_tcs_status()(task) # {'id': '1668279943'}


@skipif_auth_failed
@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason="requires vendor's webserver")
Expand Down

0 comments on commit 660bede

Please sign in to comment.