Crates.io | fly-accept-encoding |
lib.rs | fly-accept-encoding |
version | 0.2.0 |
source | src |
created_at | 2020-07-02 12:31:23.884835 |
updated_at | 2022-05-18 13:45:37.993321 |
description | Determine the best encoding possible from an Accept-Encoding HTTP header. |
homepage | |
repository | https://github.com/superfly/accept-encoding |
max_upload_size | |
id | 260616 |
size | 9,131 |
Determine the best encoding possible from an Accept-Encoding HTTP header.
Note: this is a fork of https://github.com/http-rs/accept-encoding with a few more features.
Basic usage
use fly_accept_encoding::Encoding;
use anyhow::Error;
use http::header::{HeaderMap, HeaderValue, ACCEPT_ENCODING};
fn main () -> Result<(), Error> {
let mut headers = HeaderMap::new();
headers.insert(ACCEPT_ENCODING, HeaderValue::from_str("gzip, deflate, br")?);
let encoding = fly_accept_encoding::parse(&headers)?;
assert_eq!(encoding, Some(Encoding::Gzip));
Ok(())
}
$ cargo add fly-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