def response_msgpack(handler, response):
"""
Optional MSGPACK response.
Sets MSGPACK content type to given handler.
Packs response with MSGPACK.
:return: Bytes of MSGPACK packed response
:rtype: bytes
"""
handler.set_header('Content-Type', 'application/x-msgpack')
return msgpack.packb(response, default=json_serial)
评论列表
文章目录