use http::header::HeaderValue; use netlify_headers::from_path; use std::path::{Path, PathBuf}; fn get_test_file_path>(file_name: P) -> PathBuf { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); path.push("tests"); path.push("data"); path.push(file_name); path } #[test] fn test_parse_file() { let path = get_test_file_path("_headers"); let headers = from_path(path).unwrap(); assert_eq!(3, headers.len()); let cc: &'static str = "max-age=0,no-cache,no-store,must-revalidate"; let cache_control = HeaderValue::from_static(cc); assert_eq!( cache_control, headers .get("/*") .map(|h| h.get_string("cache-control")) .unwrap() ); }