1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

tweak set_content_encoding docs

This commit is contained in:
Rob Ede
2022-01-28 20:27:16 +00:00
parent a9f497d05f
commit 21a08ca796
2 changed files with 22 additions and 20 deletions

View File

@ -299,9 +299,11 @@ impl NamedFile {
self
}
/// Set content encoding for serving this file
/// Sets content encoding for this file.
///
/// Must be used with `actix_web::middleware::Compress` to take effect.
/// This prevents the `Compress` middleware from modifying the file contents and signals to
/// browsers/clients how to decode it. For example, if serving a compressed HTML file (e.g.,
/// `index.html.gz`) then use `.set_content_encoding(ContentEncoding::Gzip)`.
#[inline]
pub fn set_content_encoding(mut self, enc: ContentEncoding) -> Self {
self.encoding = Some(enc);