|
|
@ -19,7 +19,10 @@ class MsgpackRequest(Request):
|
|
|
|
class MsgpackResponse(Response):
|
|
|
|
class MsgpackResponse(Response):
|
|
|
|
media_type = "application/msgpack"
|
|
|
|
media_type = "application/msgpack"
|
|
|
|
|
|
|
|
|
|
|
|
def render(self, content: t.Any) -> bytes:
|
|
|
|
def render(self, content: t.Optional[t.Any]) -> t.Optional[bytes]:
|
|
|
|
|
|
|
|
if content is None:
|
|
|
|
|
|
|
|
return b""
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(content, BaseModel):
|
|
|
|
if isinstance(content, BaseModel):
|
|
|
|
content = content.dict()
|
|
|
|
content = content.dict()
|
|
|
|
return msgpack.packb(content, use_bin_type=True)
|
|
|
|
return msgpack.packb(content, use_bin_type=True)
|
|
|
|