INNER CODE UNIT · Python

MessagePackMiddleware

florimondmanca/msgpack-asgi · src/msgpack_asgi/_middleware.py:13

class MessagePackMiddleware:
    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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…