Crates.io | accept-encoding-fork |
lib.rs | accept-encoding-fork |
version | 0.2.0-alpha.3 |
source | src |
created_at | 2020-02-03 09:38:41.082521 |
updated_at | 2020-02-03 09:38:41.082521 |
description | Determine the best encoding possible from an Accept-Encoding HTTP header. |
homepage | |
repository | https://github.com/rust-net-web/accept-encoding |
max_upload_size | |
id | 204418 |
size | 38,230 |
Determine the best encoding possible from an Accept-Encoding HTTP header.
Basic usage
use accept_encoding::Encoding;
use failure::Error;
use http::header::{HeaderMap, HeaderValue, ACCEPT_ENCODING};
fn main () -> Result<(), failure::Error> {
let mut headers = HeaderMap::new();
headers.insert(ACCEPT_ENCODING, HeaderValue::from_str("gzip, deflate, br")?);
let encoding = accept_encoding::parse(&headers)?;
assert_eq!(encoding, Some(Encoding::Gzip));
Ok(())
}
$ cargo add accept-encoding
This crate uses #![deny(unsafe_code)]
to ensure everything is implemented in
100% Safe Rust.
Want to join us? Check out our "Contributing" guide and take a look at some of these issues:
None.
MIT OR Apache-2.0