[core] Schema: host file model and validation with typed errors

This commit is contained in:
2026-11-07 14:36:35 +01:00
parent 9176cc63a4
commit ff087a14dd
2 changed files with 577 additions and 7 deletions
+2 -1
View File
@@ -397,7 +397,8 @@ fn rejects_invalid_header_names() {
#[test]
fn rejects_invalid_header_values() {
for bad in ["a\nb", "a\rb", "a\u{0}b", "{http.request.host}", "x}", "\u{7f}", " leading", "ü"] {
let e = single_error(&rule("response_headers", &format!("action = \"set\"\nname = \"X-A\"\nvalue = {bad:?}")));
let value = toml::Value::String(bad.to_owned()).to_string();
let e = single_error(&rule("response_headers", &format!("action = \"set\"\nname = \"X-A\"\nvalue = {value}")));
assert!(matches!(e, ValidationError::InvalidHeaderValue { .. }), "{bad:?}: {e:?}");
}
}