Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/common/content_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ use HeaderValue;
/// # Example values
///
/// * `gzip`
/// * `compress`
/// * `deflate`
/// * `br`
///
/// # Examples
///
Expand All @@ -46,6 +49,24 @@ impl ContentEncoding {
ContentEncoding(HeaderValue::from_static("gzip").into())
}

/// A constructor to easily create a `Content-Encoding: compress` header.
#[inline]
pub fn compress() -> ContentEncoding {
ContentEncoding(HeaderValue::from_static("compress").into())
}

/// A constructor to easily create a `Content-Encoding: deflate` header.
#[inline]
pub fn deflate() -> ContentEncoding {
ContentEncoding(HeaderValue::from_static("deflate").into())
}

/// A constructor to easily create a `Content-Encoding: br` header.
#[inline]
pub fn br() -> ContentEncoding {
ContentEncoding(HeaderValue::from_static("br").into())
}

/// Check if this header contains a given "coding".
///
/// This can be used with these argument types:
Expand Down