@@ -17,13 +17,13 @@ fn hello_world() -> Result<(), http_types::Error> {
17
17
let res = Response :: new ( StatusCode :: Ok ) . body_string ( "says hello" . to_string ( ) ) ;
18
18
Ok ( res)
19
19
} ) ;
20
- app. listen ( & port) . await ?;
20
+ app. listen ( ( "localhost" , port) ) . await ?;
21
21
Result :: < ( ) , http_types:: Error > :: Ok ( ( ) )
22
22
} ) ;
23
23
24
24
let client = task:: spawn ( async move {
25
25
task:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
26
- let string = surf:: get ( format ! ( "http://{}" , port) )
26
+ let string = surf:: get ( format ! ( "http://localhost: {}" , port) )
27
27
. body_string ( "nori" . to_string ( ) )
28
28
. recv_string ( )
29
29
. await ?;
@@ -43,13 +43,13 @@ fn echo_server() -> Result<(), http_types::Error> {
43
43
let mut app = tide:: new ( ) ;
44
44
app. at ( "/" ) . get ( |req| async move { Ok ( req) } ) ;
45
45
46
- app. listen ( & port) . await ?;
46
+ app. listen ( ( "localhost" , port) ) . await ?;
47
47
Result :: < ( ) , http_types:: Error > :: Ok ( ( ) )
48
48
} ) ;
49
49
50
50
let client = task:: spawn ( async move {
51
51
task:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
52
- let string = surf:: get ( format ! ( "http://{}" , port) )
52
+ let string = surf:: get ( format ! ( "http://localhost: {}" , port) )
53
53
. body_string ( "chashu" . to_string ( ) )
54
54
. recv_string ( )
55
55
. await ?;
@@ -79,13 +79,13 @@ fn json() -> Result<(), http_types::Error> {
79
79
let res = Response :: new ( StatusCode :: Ok ) . body_json ( & counter) ?;
80
80
Ok ( res)
81
81
} ) ;
82
- app. listen ( & port) . await ?;
82
+ app. listen ( ( "localhost" , port) ) . await ?;
83
83
Result :: < ( ) , http_types:: Error > :: Ok ( ( ) )
84
84
} ) ;
85
85
86
86
let client = task:: spawn ( async move {
87
87
task:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
88
- let counter: Counter = surf:: get ( format ! ( "http://{}" , & port) )
88
+ let counter: Counter = surf:: get ( format ! ( "http://localhost: {}" , & port) )
89
89
. body_json ( & Counter { count : 0 } ) ?
90
90
. recv_json ( )
91
91
. await ?;
0 commit comments