1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 23:17:43 +02:00

feat: added suport to http crate 1.0 (#508)

* chore: use same feature

* test: add test for new http version added

* stylistic review

---------

Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
morenol
2023-12-05 20:18:17 -04:00
committed by GitHub
parent 923a443950
commit 1945fa0675
4 changed files with 36 additions and 3 deletions

View File

@ -114,6 +114,23 @@ async fn test_openssl_uri() {
assert_eq!(con.peer_addr().unwrap(), srv.addr());
}
#[cfg(all(feature = "rustls-0_21", feature = "uri"))]
#[actix_rt::test]
async fn test_rustls_uri_http1() {
let srv = TestServer::start(|| {
fn_service(|io: TcpStream| async {
let mut framed = Framed::new(io, BytesCodec);
framed.send(Bytes::from_static(b"test")).await?;
Ok::<_, io::Error>(())
})
});
let conn = Connector::default().service();
let addr = http_1::Uri::try_from(format!("https://localhost:{}", srv.port())).unwrap();
let con = conn.call(addr.into()).await.unwrap();
assert_eq!(con.peer_addr().unwrap(), srv.addr());
}
#[cfg(all(feature = "rustls-0_21", feature = "uri"))]
#[actix_rt::test]
async fn test_rustls_uri() {