Skip to content

Commit cb7867e

Browse files
committed
Fix examples
1 parent 340e6ce commit cb7867e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

examples/client.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use async_h1::client;
22
use async_std::{io, net, task};
3-
use http_types::{HttpVersion, Method, Request, Url};
3+
use http_types::{Method, Request, Url};
44

55
fn main() -> Result<(), async_h1::Exception> {
66
task::block_on(async {
@@ -11,12 +11,8 @@ fn main() -> Result<(), async_h1::Exception> {
1111
for i in 0usize..2 {
1212
println!("making request {}/2", i + 1);
1313

14-
let mut req = client::encode(Request::new(
15-
HttpVersion::HTTP1_1,
16-
Method::Get,
17-
Url::parse("/foo").unwrap(),
18-
))
19-
.await?;
14+
let mut req =
15+
client::encode(Request::new(Method::Get, Url::parse("/foo").unwrap())).await?;
2016
io::copy(&mut req, &mut stream.clone()).await?;
2117

2218
// read the response

examples/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use async_h1::server;
22
use async_std::net;
33
use async_std::prelude::*;
44
use async_std::task;
5-
use http_types::{HttpVersion, Response, StatusCode};
5+
use http_types::{Response, StatusCode};
66

77
fn main() -> Result<(), async_h1::Exception> {
88
task::block_on(async {
@@ -17,7 +17,7 @@ fn main() -> Result<(), async_h1::Exception> {
1717

1818
let stream = Stream::new(stream);
1919
server::connect(stream.clone(), stream, |_| {
20-
async { Ok(Response::new(HttpVersion::HTTP1_1, StatusCode::Ok)) }
20+
async { Ok(Response::new(StatusCode::Ok)) }
2121
})
2222
.await
2323
});

0 commit comments

Comments
 (0)