From 1f5f65877ad2911c599a12e79ef794b9e16f2a39 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Wed, 21 Oct 2020 10:08:47 -0700 Subject: [PATCH] Update overall_timeout_during_headers test. --- src/test/timeout.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/timeout.rs b/src/test/timeout.rs index 2553dd9..be9654a 100644 --- a/src/test/timeout.rs +++ b/src/test/timeout.rs @@ -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]