Skip to main content

parse_cache_control

Function parse_cache_control 

Source
pub fn parse_cache_control(
    header_value: &str,
) -> HashMap<String, Option<String>>
Expand description

Parses a Cache-Control header into its directives.

ยงExamples

use ignitia::utils::headers::parse_cache_control;

let cache_control = "public, max-age=3600, must-revalidate";
let directives = parse_cache_control(cache_control);

assert_eq!(directives.get("public"), Some(&None));
assert_eq!(directives.get("max-age"), Some(&Some("3600".to_string())));
assert_eq!(directives.get("must-revalidate"), Some(&None));