Debian Codegraph @

docs/examples/request_data/msgpack_request.py

raw
1 from typing import Any, Dict
2
3 from litestar import Litestar, post
4 from litestar.params import MsgPackBody
5
6
7 @post(path="/")
8 async def msgpack_handler(
9 data: MsgPackBody[Dict[str, Any]],
10 ) -> Dict[str, Any]:
11 # This will try to parse the request body as `MessagePack` regardless of the
12 # `Content-Type`
13 return data
14
15
16 app = Litestar(route_handlers=[msgpack_handler])