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
Stream
to be compatible with async_compression’sStream
based encoders.
Functions§
- auto
- Create a wrapping handler that compresses the Body of a
hyper::Response
using gzip,deflate
,brotli
orzstd
if is specified in theAccept-Encoding
header, addingcontent-encoding: <coding>
to the Response’sHeaderMap
. It also provides the ability to apply compression for text-based MIME types only. - brotli
compression
orcompression-brotli
- Create a wrapping handler that compresses the Body of a
Response
. using brotli, addingcontent-encoding: br
to the Response’sHeaderMap
. - create_
encoding_ header - Given an optional existing encoding header, appends to the existing or creates a new one.
- deflate
compression
orcompression-deflate
- Create a wrapping handler that compresses the Body of a
Response
. using deflate, addingcontent-encoding: deflate
to the Response’sHeaderMap
. - get_
encodings - Get the
content-encodings
via theaccept-encoding
header. - get_
preferred_ encoding - Try to get the preferred
content-encoding
via theaccept-encoding
header. - gzip
compression
orcompression-gzip
- Create a wrapping handler that compresses the Body of a
Response
. using gzip, addingcontent-encoding: gzip
to the Response’sHeaderMap
. - init
- Initializes dynamic compression.
- zstd
compression
orcompression-zstd
- Create a wrapping handler that compresses the Body of a
Response
. using zstd, addingcontent-encoding: zstd
to the Response’sHeaderMap
.