feat: Process boolean True responses over Packet Stream
This commit is contained in:
parent
9b54ea6cec
commit
d6881cd8d5
@ -184,7 +184,7 @@ class MuxRPCMessage:
|
|||||||
|
|
||||||
return cls(message.body)
|
return cls(message.body)
|
||||||
|
|
||||||
def __init__(self, body: Union[bytes, str, Dict[str, Any]]):
|
def __init__(self, body: Union[bytes, str, Dict[str, Any], bool]):
|
||||||
self.body = body
|
self.body = body
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
|
@ -131,6 +131,9 @@ class PSMessage:
|
|||||||
def data(self) -> bytes:
|
def data(self) -> bytes:
|
||||||
"""The raw message data"""
|
"""The raw message data"""
|
||||||
|
|
||||||
|
if self.body is True:
|
||||||
|
return b"true"
|
||||||
|
|
||||||
if self.type == PSMessageType.TEXT:
|
if self.type == PSMessageType.TEXT:
|
||||||
assert isinstance(self.body, str)
|
assert isinstance(self.body, str)
|
||||||
|
|
||||||
@ -147,7 +150,7 @@ class PSMessage:
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
type_: PSMessageType,
|
type_: PSMessageType,
|
||||||
body: Union[bytes, str, Dict[str, Any]],
|
body: Union[bytes, str, Dict[str, Any], bool],
|
||||||
stream: bool,
|
stream: bool,
|
||||||
end_err: bool,
|
end_err: bool,
|
||||||
req: Optional[int] = None,
|
req: Optional[int] = None,
|
||||||
@ -159,7 +162,10 @@ class PSMessage:
|
|||||||
self.req = req
|
self.req = req
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
if self.type == PSMessageType.BUFFER:
|
if self.body is True:
|
||||||
|
body = "EOF"
|
||||||
|
elif self.type == PSMessageType.BUFFER:
|
||||||
|
assert isinstance(self.body, bytes)
|
||||||
body = f"{len(self.body)} bytes"
|
body = f"{len(self.body)} bytes"
|
||||||
else:
|
else:
|
||||||
body = str(self.body)
|
body = str(self.body)
|
||||||
|
Loading…
Reference in New Issue
Block a user