INNER CODE UNIT · Python
__init__
florimondmanca/msgpack-asgi · src/msgpack_asgi/_middleware.py:14
def __init__(
self,
app: ASGIApp,
*,
packb: Callable[[Any], bytes] = cast(Callable, msgpack.packb),
unpackb: Callable[[bytes], Any] = _msgpack_unpackb,
# Default to official msgpack content type one:
# https://www.iana.org/assignments/media-types/application/vnd.msgpack
# Allow customization to support older implementations, such as those using
# application/x-msgpack.
content_type: str = "application/vnd.msgpack",
allow_naive_streaming: bool = False,
) -> None:
self._app = app
self._packb = packb
self._unpackb = unpackb
self._content_type = content_type
self._allow_naive_streaming = allow_naive_streaming