You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/middleware/builtin-middleware.rst
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,10 +165,10 @@ list of domains to :class:`~litestar.app.Litestar`:
165
165
Compression
166
166
-----------
167
167
168
-
HTML responses can optionally be compressed. Litestar has built in support for gzip, brotli, and zstd. Gzip support is provided
169
-
through the built-in Starlette classes. Brotli support can be added by installing the ``brotli`` extra, and Zstd support by installing the ``zstd`` extra.
168
+
HTTP responses can optionally be compressed. Litestar has support for gzip, brotli, and zstd.
169
+
Gzip is supported by Litestar out of the box, while Brotli support can be added by installing the ``brotli`` extra, and Zstd support can be added by installing the ``zstd`` extra.
170
170
171
-
You can enable either backend by passing an instance of
171
+
You can enable any one of these backends by passing an instance of
172
172
:class:`~litestar.config.compression.CompressionConfig` to ``compression_config`` of
173
173
:class:`~litestar.app.Litestar`.
174
174
@@ -182,9 +182,9 @@ You can configure the following additional gzip-specific values:
182
182
183
183
184
184
* ``minimum_size``: the minimum threshold for response size to enable compression. Smaller responses will not be
185
-
compressed. Defaults is ``500``, i.e. half a kilobyte.
185
+
compressed. Default is ``500``, i.e. half a kilobyte.
186
186
* ``gzip_compress_level``: a range between 0-9, see the `official python docs <https://docs.python.org/3/library/gzip.html>`_.
187
-
Defaults to ``9``, which is the maximum value.
187
+
Defaults to ``9``, which is the maximum value.
188
188
189
189
.. code-block:: python
190
190
@@ -232,16 +232,15 @@ You can configure the following additional brotli-specific values:
232
232
Zstd
233
233
^^^^^^
234
234
235
-
The `Zstd<https://pypi.org/project/zstd>`_ package is required to run this middleware. It is available as an extra for Litestar via the ``zstd`` extra: (``pip install 'litestar[zstd]'``).
235
+
The `zstandard<https://pypi.org/project/zstandard>`_ package is required to run this middleware. It is available as an extra for Litestar via the ``zstd`` extra: (``pip install 'litestar[zstd]'``).
236
236
237
237
You can enable zstd compression of responses by passing an instance of
238
238
:class:`~litestar.config.compression.CompressionConfig` with the ``backend`` parameter set to ``"zstd"``.
239
239
240
240
You can configure the following additional zstd-specific values:
241
241
242
-
* ``minimum_size``: the minimum threshold for response size to enable compression. Smaller responses will not be
243
-
compressed. Default is 500, i.e. half a kilobyte.
244
-
* ``zstd_level``: Range [0-22], Controls the compression level. Higher values increase compression ratio but are slower. Default is 3.
242
+
* ``minimum_size``: the minimum threshold for response size to enable compression. Smaller responses will not be compressed. Default is 500, i.e. half a kilobyte.
243
+
* ``zstd_compress_level``: Range [0-22], Controls the compression level. Higher values increase compression ratio but are slower. Default is 3.
245
244
* ``zstd_gzip_fallback``: Boolean indicating whether to fall back to gzip if Zstd is not supported. Default is True.
0 commit comments