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