Skip to content

Commit 49ab4b1

Browse files
committed
Fix up client
1 parent cb7867e commit 49ab4b1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/client.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use async_std::prelude::*;
55
use async_std::task::{Context, Poll};
66
use futures_core::ready;
77
use futures_io::AsyncRead;
8-
use http_types::{HttpVersion, Request, Response, StatusCode};
8+
use http_types::{Request, Response, StatusCode};
99

1010
use std::pin::Pin;
1111

@@ -101,12 +101,11 @@ where
101101

102102
// Convert httparse headers + body into a `http::Response` type.
103103
let version = httparse_res.version.ok_or_else(|| "No version found")?;
104-
let version = match version {
105-
1 => HttpVersion::HTTP1_1,
106-
_ => return Err("Unsupported HTTP version".into()),
107-
};
104+
if version != 1 {
105+
return Err("Unsupported HTTP version".into());
106+
}
108107
use std::convert::TryFrom;
109-
let mut res = Response::new(version, StatusCode::try_from(code)?);
108+
let mut res = Response::new(StatusCode::try_from(code)?);
110109
for header in httparse_res.headers.iter() {
111110
res = res.set_header(header.name, std::str::from_utf8(header.value)?)?;
112111
}

0 commit comments

Comments
 (0)