hyperium / headers

Typed HTTP Headers from hyper
https://hyper.rs
MIT License
162 stars 84 forks source link

Document common usage #136

Open nakedible-p opened 1 year ago

nakedible-p commented 1 year ago

The documentation for the crate does not specify what is the common way to use this crate - it only explains how to extend it for new headers.

It took a bit of trial and error until I finally found the trait HeaderMapExt. And even that trait isn't documented.

The documentation should have something like:

use headers::HeaderMapExt;

let mut headers = HeaderMap::new();
headers.typed_insert(Upgrade::websocket());
let ws = headers.typed_get::<Upgrade>();