@@ -2,7 +2,7 @@ use anyhow::Result;
22use http_body_util:: { BodyExt , Full } ;
33use hyper:: body:: Bytes ;
44use hyper:: Request ;
5- use hyper_util:: client:: legacy:: { connect :: HttpConnector , Client } ;
5+ use hyper_util:: client:: legacy:: Client ;
66use hyper_vsock:: VsockClientExt ;
77use hyperlocal:: { UnixClientExt , UnixConnector , Uri } ;
88use log:: debug;
@@ -54,15 +54,13 @@ pub async fn http_request(
5454 . body ( Full :: new ( Bytes :: copy_from_slice ( body) ) ) ?;
5555 client. request ( req) . await ?
5656 } else {
57- let client =
58- Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) ) . build ( HttpConnector :: new ( ) ) ;
59-
60- let uri = mk_url ( base, path) . parse :: < hyper:: Uri > ( ) ?;
61- let req = Request :: builder ( )
62- . method ( method)
63- . uri ( uri)
64- . body ( Full :: new ( Bytes :: copy_from_slice ( body) ) ) ?;
65- client. request ( req) . await ?
57+ let uri = mk_url ( base, path) ;
58+ let client = reqwest:: Client :: builder ( ) . build ( ) ?;
59+ let response = client. post ( uri) . body ( body. to_vec ( ) ) . send ( ) . await ?;
60+ return Ok ( (
61+ response. status ( ) . as_u16 ( ) ,
62+ response. text ( ) . await ?. into_bytes ( ) ,
63+ ) ) ;
6664 } ;
6765 debug ! ( "Response: {:?}" , response) ;
6866 let mut body = Vec :: new ( ) ;
0 commit comments