Skip to content

Commit 35b66a3

Browse files
committed
tests: add head_example_org case
Refs: http-rs#218
1 parent 8f00394 commit 35b66a3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/test.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use futures_util::future::BoxFuture;
44
use http_types::Body;
55

66
use surf::{middleware::Next, Client, Request, Response};
7-
87
#[async_std::test]
98
async fn post_json() -> Result<(), http_types::Error> {
109
#[derive(serde::Deserialize, serde::Serialize)]
@@ -47,6 +46,21 @@ async fn get_json() -> Result<(), http_types::Error> {
4746
Ok(())
4847
}
4948

49+
#[async_std::test]
50+
async fn head_example_org() -> Result<(), http_types::Error> {
51+
let mut res = surf::head("http://example.com").await?;
52+
53+
assert_eq!(res.status(), surf::StatusCode::Ok);
54+
assert!(res.len().is_some());
55+
56+
let body = res.body_bytes().await?;
57+
58+
assert_eq!(body.len(), 0);
59+
60+
Ok(())
61+
}
62+
63+
5064
#[async_std::test]
5165
async fn get_google() -> Result<(), http_types::Error> {
5266
femme::start(log::LevelFilter::Trace).ok();

0 commit comments

Comments
 (0)