Function zaplib::universal_http_stream::request
source · [−]pub fn request(
url: &str,
method: &str,
body: &[u8],
headers: &[(&str, &str)]
) -> Result<Box<dyn Read + Send>>
Expand description
Create an HTTP stream that you can synchronously read from as data comes in.
Automatically supports gzip (native) or whatever your browser supports (wasm). TODO(JP): Maybe make compression support optional for native builds?
Returns a std::io::Read
er that blocks until there is data available. It is
highly recommended to only use this in a dedicated thread, and to wrap it in
std::io::BufReader
.
TODO(JP): See if there is some way to unify this with crate::universal_file::UniversalFile
.