Skip to content

Commit c2daf2f

Browse files
authored
Add missing JSON decode in get_extended_address (#25)
1 parent 16f9aae commit c2daf2f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python_otbr_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ async def get_extended_address(self) -> bytes:
113113
raise OTBRError(f"unexpected http status {response.status}")
114114

115115
try:
116-
return bytes.fromhex(await response.text("ASCII"))
116+
return bytes.fromhex(await response.json())
117117
except ValueError as exc:
118118
raise OTBRError("unexpected API response") from exc

tests/test_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def test_get_extended_address(aioclient_mock: AiohttpClientMocker) -> None
9090

9191
mock_response = "4EF6C4F3FF750626"
9292

93-
aioclient_mock.get(f"{BASE_URL}/node/ext-address", text=mock_response)
93+
aioclient_mock.get(f"{BASE_URL}/node/ext-address", json=mock_response)
9494

9595
assert await otbr.get_extended_address() == bytes.fromhex(mock_response)
9696

0 commit comments

Comments
 (0)