Fix Response.data normalisation in parse_message() too
The previous commit only fixed Response.from_json(), but the serial client's read loop uses parse_message() which constructs Response directly. Apply the same string-to-dict normalisation there.
This commit is contained in:
parent
ea22f2f9db
commit
82cd0e5c9d
@ -207,11 +207,14 @@ def parse_message(line: str) -> Command | Response | Event:
|
||||
)
|
||||
|
||||
if msg_type == MsgType.RESP:
|
||||
raw_data = obj.get("data", {})
|
||||
if isinstance(raw_data, str):
|
||||
raw_data = {"error": raw_data}
|
||||
return Response(
|
||||
type=MsgType.RESP,
|
||||
id=obj["id"],
|
||||
status=Status(obj["status"]),
|
||||
data=obj.get("data", {}),
|
||||
data=raw_data if isinstance(raw_data, dict) else {},
|
||||
)
|
||||
|
||||
if msg_type == MsgType.EVENT:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user