Crates.io | clia-reqwest-ntex-stream |
lib.rs | clia-reqwest-ntex-stream |
version | 1.0.1 |
source | src |
created_at | 2022-03-22 12:43:32.189044 |
updated_at | 2022-03-24 13:27:47.6181 |
description | A Stream to link between Reqwest and ntex two systems. |
homepage | |
repository | https://github.com/clia/reqwest-ntex-stream |
max_upload_size | |
id | 554671 |
size | 10,717 |
A Stream to link between Reqwest and ntex two systems.
async fn handle(
body: ntex::web::types::Payload,
) {
let mut builder = client.get(url);
// This stream is not for send between threads, otherwise it's unsafe.
builder = builder.body(reqwest::Body::wrap_stream(reqwest_ntex_stream::PayloadStream {
payload: body,
}));
builder.send().await;
}
let res = builder.send().await;
let stream = res.bytes_stream();
let mut resp = HttpResponse::build(res.status());
// This method will use chunked Transfer-Encoding, otherwise use ntex::http::body::SizedStream
return Ok(resp.streaming(reqwest_ntex_stream::ResponseStream{ stream: stream }));