File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use async_std::prelude::*;
5
5
use async_std:: task:: { Context , Poll } ;
6
6
use futures_core:: ready;
7
7
use futures_io:: AsyncRead ;
8
- use http_types:: { HttpVersion , Request , Response , StatusCode } ;
8
+ use http_types:: { Request , Response , StatusCode } ;
9
9
10
10
use std:: pin:: Pin ;
11
11
@@ -101,12 +101,11 @@ where
101
101
102
102
// Convert httparse headers + body into a `http::Response` type.
103
103
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
+ }
108
107
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) ?) ;
110
109
for header in httparse_res. headers . iter ( ) {
111
110
res = res. set_header ( header. name , std:: str:: from_utf8 ( header. value ) ?) ?;
112
111
}
You can’t perform that action at this time.
0 commit comments