diff options
author | khai96_ <hvksmr1996@gmail.com> | 2019-05-04 06:36:32 +0000 |
---|---|---|
committer | khai96_ <hvksmr1996@gmail.com> | 2019-05-04 06:36:32 +0000 |
commit | 67b2ec8e70d0f781b3f57762c1e8e28c2102c15d (patch) | |
tree | 21d62f767daa956b0e6bd4a643017f810718bf1b /tests/auth.rs | |
parent | Merge pull request #99 from KSXGitHub/new-clippy (diff) | |
download | miniserve-67b2ec8e70d0f781b3f57762c1e8e28c2102c15d.tar.gz miniserve-67b2ec8e70d0f781b3f57762c1e8e28c2102c15d.zip |
Add assertion of status code to auth_works
Diffstat (limited to 'tests/auth.rs')
-rw-r--r-- | tests/auth.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auth.rs b/tests/auth.rs index f43553b..af2db58 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -43,11 +43,15 @@ fn auth_works( sleep(Duration::from_secs(1)); let client = reqwest::Client::new(); - let body = client + let response = client .get(format!("http://localhost:{}", port).as_str()) .basic_auth(client_username, Some(client_password)) - .send()? - .error_for_status()?; + .send()?; + + let status_code = response.status(); + assert_eq!(status_code.canonical_reason(), Some("OK")); + + let body = response.error_for_status()?; let parsed = Document::from_read(body)?; for &file in FILES { assert!(parsed.find(Text).any(|x| x.text() == file)); |