Skip to content

Commit ced4aae

Browse files
committed
Fix wildcard serialization in Vary
1 parent fbaed33 commit ced4aae

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/conditional/vary.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ impl Vary {
102102
};
103103
}
104104

105+
if self.wildcard {
106+
match output.len() {
107+
0 => write!(output, "*").unwrap(),
108+
_ => write!(output, ", *").unwrap(),
109+
};
110+
}
111+
105112
// SAFETY: the internal string is validated to be ASCII.
106113
unsafe { HeaderValue::from_bytes_unchecked(output.into()) }
107114
}
@@ -262,7 +269,7 @@ mod test {
262269
fn wildcard() -> crate::Result<()> {
263270
let mut entries = Vary::new();
264271
entries.push("User-Agent")?;
265-
entries.push("*")?;
272+
entries.set_wildcard(true);
266273

267274
let mut res = Response::new(200);
268275
entries.apply(&mut res);

0 commit comments

Comments
 (0)