File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ version = "0.1.0"
55edition = " 2021"
66
77[dependencies ]
8- hyper = { version = " 0.14.18" , features = [" client" ] }
9- hyper-rustls = " 0.23.0"
10- rustls = " 0.22"
11- tokio = { version = " 1.18.2" , features = [" rt-multi-thread" , " macros" ] }
8+ http-body-util = " 0.1.2"
9+ hyper = { version = " 1.6.0" , features = [" client" ] }
10+ hyper-rustls = " 0.27.5"
11+ hyper-util = " 0.1.10"
12+ rustls = " 0.23"
13+ tokio = { version = " 1.43.0" , features = [" rt-multi-thread" , " macros" ] }
Original file line number Diff line number Diff line change 1- use hyper:: { Body , Client , StatusCode , Uri } ;
1+ use http_body_util:: Empty ;
2+ use hyper:: body:: Bytes ;
3+ use hyper:: http:: StatusCode ;
4+ use hyper_util:: client:: legacy:: Client ;
5+ use hyper_util:: rt:: TokioExecutor ;
26
37#[ tokio:: main]
48async fn main ( ) {
59 let url = ( "https://hyper.rs" ) . parse ( ) . unwrap ( ) ;
610 let https = hyper_rustls:: HttpsConnectorBuilder :: new ( )
711 . with_native_roots ( )
12+ . expect ( "no native root CA certificates found" )
813 . https_only ( )
914 . enable_http1 ( )
1015 . build ( ) ;
1116
12- let client: Client < _ , hyper :: Body > = Client :: builder ( ) . build ( https) ;
17+ let client: Client < _ , Empty < Bytes > > = Client :: builder ( TokioExecutor :: new ( ) ) . build ( https) ;
1318
1419 let res = client. get ( url) . await . unwrap ( ) ;
1520 assert_eq ! ( res. status( ) , StatusCode :: OK ) ;
You can’t perform that action at this time.
0 commit comments