compression#
- class starlite.middleware.compression.CompressionFacade#
Bases:
object
A unified facade offering a uniform interface for different compression libraries.
- __init__(buffer: BytesIO, compression_encoding: CompressionEncoding, config: CompressionConfig) None #
Initialize
CompressionFacade
.- Parameters:
buffer – A bytes IO buffer to write the compressed data into.
compression_encoding – The compression encoding used.
config – The app compression config.
- class starlite.middleware.compression.CompressionMiddleware#
Bases:
AbstractMiddleware
Compression Middleware Wrapper.
This is a wrapper allowing for generic compression configuration / handler middleware
- __init__(app: ASGIApp, config: CompressionConfig) None #
Initialize
CompressionMiddleware
- Parameters:
app – The
next
ASGI app to call.config – An instance of CompressionConfig.
- create_compression_send_wrapper(send: Send, compression_encoding: ~typing.Literal[<CompressionEncoding.BROTLI: 'br'>, <CompressionEncoding.GZIP: 'gzip'>], scope: Scope) Send #
Wrap
send
to handle brotli compression.- Parameters:
send – The ASGI send function.
compression_encoding – The compression encoding used.
scope – The ASGI connection scope
- Returns:
An ASGI send function.