From 8c04e4669daadf2e0ce91082a817ffcc940d65a1 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Wed, 4 Nov 2020 15:28:41 -0800 Subject: [PATCH 1/3] tests: add head_example_org case Refs: https://github.com/http-rs/surf/issues/218 --- tests/test.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test.rs b/tests/test.rs index 972217c6..526f9c8c 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?; + + 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(); From c3a91e9571e02539e9efe5339f29578a05f8d015 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Wed, 4 Nov 2020 15:43:24 -0800 Subject: [PATCH 2/3] REMOVE ME: ci: take backtraces --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c72b29ea..655a6955 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: From df0583224781b832bcab172a1c017ac1892ab75f Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Wed, 4 Nov 2020 16:02:27 -0800 Subject: [PATCH 3/3] TRY: unwrap sooner, maybe get a more useful stack? --- tests/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test.rs b/tests/test.rs index 526f9c8c..5049ded8 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -48,7 +48,7 @@ async fn get_json() -> Result<(), http_types::Error> { #[async_std::test] async fn head_example_org() -> Result<(), http_types::Error> { - let mut res = surf::head("http://example.com").await?; + let mut res = surf::head("http://example.com").await.unwrap(); assert_eq!(res.status(), surf::StatusCode::Ok); assert!(res.len().is_some());