Make the blocking API an optional feature (default off)

This commit is contained in:
Sean McArthur
2019-09-17 15:06:10 -07:00
parent 0a87d3d7da
commit 7e3c1bc461
11 changed files with 71 additions and 49 deletions

View File

@@ -290,7 +290,7 @@ impl Response {
where
W: io::Write,
{
io::copy(self, w).map_err(crate::error::response)
io::copy(self, w).map_err(crate::error::decode_io)
}
/// Turn a response into an error if the server returned an error.
@@ -365,8 +365,8 @@ impl Read for Response {
let timeout = self.timeout;
wait::timeout(self.body_mut().read(buf), timeout).map_err(|e| match e {
wait::Waited::TimedOut(e) => crate::error::response(e).into_io(),
wait::Waited::Executor(e) => crate::error::response(e).into_io(),
wait::Waited::TimedOut(e) => crate::error::decode(e).into_io(),
wait::Waited::Executor(e) => crate::error::decode(e).into_io(),
wait::Waited::Inner(e) => e,
})
}