Add RequestBuilder::version() method to set HTTP version (#1243)

Closes #1240
This commit is contained in:
bensadiku
2021-04-15 04:03:22 +02:00
committed by GitHub
parent 7afade446c
commit 18dfac4fe2
3 changed files with 110 additions and 7 deletions

View File

@@ -1106,7 +1106,7 @@ impl Client {
}
pub(super) fn execute_request(&self, req: Request) -> Pending {
let (method, url, mut headers, body, timeout) = req.pieces();
let (method, url, mut headers, body, timeout, version) = req.pieces();
if url.scheme() != "http" && url.scheme() != "https" {
return Pending::new_err(error::url_bad_scheme(url));
}
@@ -1157,6 +1157,7 @@ impl Client {
let mut req = hyper::Request::builder()
.method(method.clone())
.uri(uri)
.version(version)
.body(body.into_stream())
.expect("valid request parts");