diff --git a/tests/tokio.rs b/tests/tokio.rs index 52f70c6..a858f89 100644 --- a/tests/tokio.rs +++ b/tests/tokio.rs @@ -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); +}