File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 70
70
71
71
let mut req = Request :: new ( Method :: from_str ( method) ?, url) ;
72
72
73
+ req. set_version ( Some ( http_types:: Version :: Http1_1 ) ) ;
74
+
73
75
for header in httparse_req. headers . iter ( ) {
74
76
req. insert_header ( header. name , std:: str:: from_utf8 ( header. value ) ?) ;
75
77
}
Original file line number Diff line number Diff line change @@ -155,3 +155,19 @@ async fn empty_body_for_head_requests() {
155
155
156
156
case. assert ( ) . await ;
157
157
}
158
+
159
+ #[ async_std:: test]
160
+ async fn test_req_http_version ( ) {
161
+ let case = TestCase :: new_server (
162
+ "fixtures/request-add-date.txt" ,
163
+ "fixtures/response-add-date.txt" ,
164
+ )
165
+ . await ;
166
+
167
+ async_h1:: accept ( case. clone ( ) , |req| async move {
168
+ assert_eq ! ( req. version( ) , Some ( http_types:: Version :: Http1_1 ) ) ;
169
+ Ok ( Response :: new ( StatusCode :: Ok ) )
170
+ } )
171
+ . await
172
+ . unwrap ( ) ;
173
+ }
You can’t perform that action at this time.
0 commit comments