Function kanidmd_core::https::middleware::compression_content_type_checker
source · pub fn compression_content_type_checker() -> Regex
Expand description
This is for the tide_compression middleware so that we only compress certain content types.
use kanidmd_core::https::middleware::compression_content_type_checker;
let these_should_match = vec![
"application/wasm",
"application/x-javascript",
"application/x-javascript; charset=utf-8",
"image/svg+xml",
"text/json",
"text/javascript",
];
for test_value in these_should_match {
eprintln!("checking {:?}", test_value);
assert!(compression_content_type_checker().is_match(test_value));
}
assert!(compression_content_type_checker().is_match("application/wasm"));
let these_should_be_skipped = vec![
"application/manifest+json",
"image/jpeg",
"image/wasm",
"text/html",
];
for test_value in these_should_be_skipped {
eprintln!("checking {:?}", test_value);
assert!(!compression_content_type_checker().is_match(test_value));
}