Update overall_timeout_during_headers test.

This commit is contained in:
Jacob Hoffman-Andrews
2020-10-21 10:08:47 -07:00
committed by Martin Algesten
parent 14475cb5c7
commit 1f5f65877a

View File

@@ -28,15 +28,15 @@ fn get_and_expect_timeout(url: String) {
let agent = Agent::default().build();
let timeout = Duration::from_millis(500);
let resp = agent.get(&url).timeout(timeout).call();
match resp.into_string() {
Err(io_error) => match io_error.kind() {
io::ErrorKind::TimedOut => Ok(()),
_ => Err(format!("{:?}", io_error)),
},
Ok(_) => Err("successful response".to_string()),
}
.expect("expected timeout but got something else");
assert!(
matches!(resp.synthetic_error(), Some(Error::Io(_))),
"expected timeout error, got {:?}",
resp.synthetic_error()
);
assert_eq!(
resp.synthetic_error().as_ref().unwrap().body_text(),
"Network Error: timed out reading response"
);
}
#[test]