accept-encoding 0.1.0

Determine the best encoding possible from an Accept-Encoding HTTP header.
Documentation

accept-encoding

crates.io version build status downloads docs.rs docs

Determine the best encoding possible from an Accept-Encoding HTTP header.

Examples

Basic usage

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!(encoding.is_brotli());
  Ok(())
}

Installation

$ cargo add accept-encoding

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

References

None.

License

MIT OR Apache-2.0