Available on crate features
compression or compression-gzip or compression-brotli or compression-zstd or compression-deflate only.Expand description
Auto-compression module to compress responses body.
Structs§
- Compressable
Body - A wrapper around any type that implements
Streamto be compatible with async_compression’sStreambased encoders.
Functions§
- auto
- Create a wrapping handler that compresses the Body of a
hyper::Responseusing gzip,deflate,brotliorzstdif is specified in theAccept-Encodingheader, addingcontent-encoding: <coding>to the Response’sHeaderMap. It also provides the ability to apply compression for text-based MIME types only. - brotli
compressionorcompression-brotli - Create a wrapping handler that compresses the Body of a
Response. using brotli, addingcontent-encoding: brto the Response’sHeaderMap. - create_
encoding_ header - Given an optional existing encoding header, appends to the existing or creates a new one.
- deflate
compressionorcompression-deflate - Create a wrapping handler that compresses the Body of a
Response. using deflate, addingcontent-encoding: deflateto the Response’sHeaderMap. - get_
encodings - Get the
content-encodingsvia theaccept-encodingheader. - get_
preferred_ encoding - Try to get the preferred
content-encodingvia theaccept-encodingheader. - gzip
compressionorcompression-gzip - Create a wrapping handler that compresses the Body of a
Response. using gzip, addingcontent-encoding: gzipto the Response’sHeaderMap. - init
- Initializes dynamic compression.
- zstd
compressionorcompression-zstd - Create a wrapping handler that compresses the Body of a
Response. using zstd, addingcontent-encoding: zstdto the Response’sHeaderMap.