diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c72b29e..655a695 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,7 @@ on: env: RUSTFLAGS: -Dwarnings + RUST_BACKTRACE: full jobs: build_and_test: diff --git a/tests/test.rs b/tests/test.rs index 972217c..5049ded 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -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)] @@ -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.unwrap(); + + 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();