Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
zuisong committed Mar 26, 2024
1 parent 46b0094 commit 4e7c9d0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ async fn auto_headers() {
assert_eq!(res.remote_addr(), Some(server.addr()));
}

#[tokio::test]
async fn donot_set_conent_length_0_if_have_no_body() {
let server = server::http(move |req| async move {
let headers = req.headers();
assert_eq!(headers.get("content-length"), None);
dbg!(&headers);
http::Response::default()
});

let url = format!("http://{}/conent-length", server.addr());
let res = reqwest::Client::builder()
.no_proxy()
.build()
.expect("client builder")
.get(&url)
.send()
.await
.expect("request");

assert_eq!(res.status(), reqwest::StatusCode::OK);
}

#[tokio::test]
async fn user_agent() {
let server = server::http(move |req| async move {
Expand Down

0 comments on commit 4e7c9d0

Please sign in to comment.