Skip to content

Commit 42a4a08

Browse files
committed
Test new Accept negotiation behaviour
1 parent 32d16b8 commit 42a4a08

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/content/accept.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,22 @@ mod test {
420420
assert_eq!(accept.negotiate(&[mime::XML])?, mime::XML);
421421
Ok(())
422422
}
423+
424+
#[test]
425+
fn negotiate_missing_encoding() -> crate::Result<()> {
426+
let mime_html = "text/html".parse::<Mime>()?;
427+
428+
let mut browser_accept = Accept::new();
429+
browser_accept.push(MediaTypeProposal::new(mime_html, None)?);
430+
431+
let acceptable = &[mime::HTML];
432+
433+
let content_type = browser_accept.negotiate(acceptable);
434+
435+
assert!(
436+
content_type.is_ok(),
437+
"server is expected to return HTML content"
438+
);
439+
Ok(())
440+
}
423441
}

0 commit comments

Comments
 (0)