Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more ContentEncoding options #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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