Skip to main content

Module vary

Module vary 

Source
Expand description

Vary response header helper.

The Vary type represents the set of request header names that affect the cacheability of a response (RFC 7231 §7.1.4). A wildcard * value indicates that the response is uncacheable regardless of request headers.

§Example

use api_bones::vary::Vary;

let mut vary = Vary::new();
vary.add("Accept");
vary.add("Accept-Encoding");
assert!(vary.contains("accept"));          // case-insensitive
assert_eq!(vary.to_string(), "Accept, Accept-Encoding");

let wildcard = Vary::wildcard();
assert!(wildcard.is_wildcard());
assert_eq!(wildcard.to_string(), "*");

Structs§

ParseVaryError
Error returned when parsing a Vary header fails.

Enums§

Vary
The Vary response header (RFC 7231 §7.1.4).