Skip to content

Commit

Permalink
test: add a unit test for invalid http::Request
Browse files Browse the repository at this point in the history
This is to make sure that we don't panic anymore in such cases:
snapview#267
  • Loading branch information
daniel-abramov authored and a-miyashita committed Jul 20, 2023
1 parent 0806976 commit dd5c1c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/handshake/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,10 @@ mod tests {
assert_eq!(resp.status(), http::StatusCode::OK);
assert_eq!(resp.headers().get("Content-Type").unwrap(), &b"text/html"[..],);
}

#[test]
fn invalid_custom_request() {
let request = http::Request::builder().method("GET").body(()).unwrap();
assert!(generate_request(request).is_err());
}
}

0 comments on commit dd5c1c1

Please sign in to comment.