File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -121,8 +121,14 @@ impl AsyncWrite for Stream {
121121async fn test_connect ( ) {
122122 crate :: tests:: start_server ( 30000 ) . await ;
123123 let stream = Stream :: connect ( & Url :: from ( "http://127.0.0.1:30000/get" ) , Duration :: from_secs ( 2 ) ) . await ;
124+ if let Err ( error) = stream. as_ref ( ) {
125+ println ! ( "{:?}" , error) ;
126+ }
124127 assert ! ( stream. is_ok( ) ) ;
125128 let stream = Stream :: connect ( & Url :: from ( "http://localhost:30000/get" ) , Duration :: from_secs ( 2 ) ) . await ;
129+ if let Err ( error) = stream. as_ref ( ) {
130+ println ! ( "{:?}" , error) ;
131+ }
126132 assert ! ( stream. is_ok( ) ) ;
127133 let stream = Stream :: connect ( & Url :: from ( "http://localhost:88/get" ) , Duration :: from_secs ( 2 ) ) . await ;
128134 assert ! ( stream. is_err( ) ) ;
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ pub mod tests {
3737 use serde_json:: json;
3838 use serde_json:: Value ;
3939 use std:: collections:: HashMap ;
40+ use std:: net:: IpAddr ;
41+ use std:: net:: Ipv6Addr ;
42+ use std:: net:: SocketAddr ;
4043
4144 pub async fn start_server ( port : u16 ) {
4245 let router = Router :: new ( )
@@ -45,8 +48,8 @@ pub mod tests {
4548 . route ( "/json" , post ( handle_json) )
4649 . route ( "/form" , post ( handle_form) )
4750 . route ( "/multipart" , post ( handle_multipart) ) ;
48-
49- let listener = tokio:: net:: TcpListener :: bind ( ( "127.0.0.1" , port ) ) . await . unwrap ( ) ;
51+ let addr = & SocketAddr :: new ( IpAddr :: from ( Ipv6Addr :: UNSPECIFIED ) , port ) ;
52+ let listener = tokio:: net:: TcpListener :: bind ( addr ) . await . unwrap ( ) ;
5053 tokio:: spawn ( async move {
5154 axum:: serve ( listener, router) . await . unwrap ( ) ;
5255 } ) ;
You can’t perform that action at this time.
0 commit comments