Last active
June 5, 2020 06:37
-
-
Save endor/4aab0dc39f844af634b6dbf37f9ad731 to your computer and use it in GitHub Desktop.
hyper::Body::channel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let (sender, hyper_body) = hyper::Body::channel(); | |
let mut runtime = tokio::runtime::Runtime::new().unwrap(); | |
let handle = runtime.spawn(async { | |
parser::parse_and_send( | |
reader, | |
sender, | |
reference, | |
).await | |
}) | |
runtime.block_on(async move { | |
let client = reqwest::Client::builder() | |
.timeout(Duration::from_secs(480)) | |
.build() | |
.unwrap(); | |
let body = reqwest::Body::wrap_stream(hyper_body); | |
let response = self | |
.client | |
.post(url) | |
.body(body) | |
.send() | |
.await; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment