Skip to content

Commit

Permalink
tests: add head_example_org case
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishrock123 committed Nov 4, 2020
1 parent 8f00394 commit 8c04e46
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use futures_util::future::BoxFuture;
use http_types::Body;

use surf::{middleware::Next, Client, Request, Response};

#[async_std::test]
async fn post_json() -> Result<(), http_types::Error> {
#[derive(serde::Deserialize, serde::Serialize)]
Expand Down Expand Up @@ -47,6 +46,20 @@ async fn get_json() -> Result<(), http_types::Error> {
Ok(())
}

#[async_std::test]
async fn head_example_org() -> Result<(), http_types::Error> {
let mut res = surf::head("http://example.com").await?;

assert_eq!(res.status(), surf::StatusCode::Ok);
assert!(res.len().is_some());

let body = res.body_bytes().await?;

assert_eq!(body.len(), 0);

Ok(())
}

#[async_std::test]
async fn get_google() -> Result<(), http_types::Error> {
femme::start(log::LevelFilter::Trace).ok();
Expand Down

0 comments on commit 8c04e46

Please sign in to comment.