Skip to content

Instantly share code, notes, and snippets.

@endor
Last active June 5, 2020 06:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save endor/4aab0dc39f844af634b6dbf37f9ad731 to your computer and use it in GitHub Desktop.
hyper::Body::channel
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