Expand description
§vary-header — append fields to an HTTP Vary header
Correctly add field names to a Vary response header: de-duplicating
case-insensitively, preserving the existing casing, and collapsing to * when
appropriate. A faithful Rust port of the vary
npm package (used by cors, compression, …). Zero dependencies and #![no_std].
use vary_header::append;
assert_eq!(append("", "Accept").unwrap(), "Accept");
assert_eq!(append("Accept", "Accept-Encoding").unwrap(), "Accept, Accept-Encoding");
assert_eq!(append("Accept", "accept").unwrap(), "Accept"); // already present
assert_eq!(append("Accept", "*").unwrap(), "*"); // varies on everythingEnums§
- Vary
Error - An error returned when a field cannot be appended.
Functions§
- append
- Append
fieldto aVaryheader value, returning the new value. - append_
fields - Append several already-separated field names to a
Varyheader value.