File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 1
- use async_std:: fs:: File ;
2
- use async_std:: io:: BufReader ;
3
1
use async_std:: net:: { TcpListener , TcpStream } ;
4
2
use async_std:: prelude:: * ;
5
3
use async_std:: task;
6
- use http_types:: { Body , Response , StatusCode } ;
4
+ use http_types:: { Response , StatusCode } ;
7
5
8
6
#[ async_std:: main]
9
7
async fn main ( ) -> http_types:: Result < ( ) > {
@@ -32,11 +30,7 @@ async fn accept(addr: String, stream: TcpStream) -> http_types::Result<()> {
32
30
async_h1:: accept ( & addr, stream. clone ( ) , |_req| async move {
33
31
let mut res = Response :: new ( StatusCode :: Ok ) ;
34
32
res. insert_header ( "Content-Type" , "text/plain" ) ?;
35
- let body = Body :: from_reader (
36
- BufReader :: new ( File :: open ( "tests/fixtures/zeros.txt" ) . await ?) ,
37
- None ,
38
- ) ;
39
- res. set_body ( body) ;
33
+ res. set_body ( "Hello world" ) ;
40
34
Ok ( res)
41
35
} )
42
36
. await ?;
You can’t perform that action at this time.
0 commit comments