Skip to content
This repository was archived by the owner on Jun 21, 2020. It is now read-only.

accept-encoding

crates.io versionbuild statusdownloadsdocs.rs docs

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

Examples

Basic usage

use accept_encoding::Encoding;use failure::Error;use http::header::{HeaderMap,HeaderValue,ACCEPT_ENCODING};fnmain() -> Result<(), failure::Error>{letmut 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(())}

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

About

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

Topics

Resources

Code of conduct

Contributing

Stars

14 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages