Skip to content

Commit

Permalink
Test http2 requests accepted.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstyura committed Jun 28, 2024
1 parent 089d866 commit 503c148
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,26 @@ async fn hello_reqwest_actix() {

assert_eq!(resp.status(), 200);
}

#[tokio::test]
async fn hello_reqwest_http2() {
let mock_server = MockServer::start().await;

Mock::given(method("GET"))
.and(path("/"))
.respond_with(ResponseTemplate::new(200))
.mount(&mock_server)
.await;

let resp = Client::builder()
.http2_prior_knowledge()
.build()
.expect("http client")
.get(&mock_server.uri())
.send()
.await
.expect("response");

assert_eq!(resp.status(), 200);
assert_eq!(resp.version(), reqwest::Version::HTTP_2);
}

0 comments on commit 503c148

Please sign in to comment.