Make the blocking API an optional feature (default off)
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
//! The blocking `Client` will block the current thread to execute, instead
|
||||
//! of returning futures that need to be executed on a runtime.
|
||||
//!
|
||||
//! ## Making a GET request
|
||||
//! # Optional
|
||||
//!
|
||||
//! This requires the optional `blocking` feature to be enabled.
|
||||
//!
|
||||
//! # Making a GET request
|
||||
//!
|
||||
//! For a single request, you can use the [`get`](get) shortcut method.
|
||||
//!
|
||||
@@ -28,7 +32,7 @@
|
||||
//! [`Client`](Client) and reuse it, taking advantage of keep-alive connection
|
||||
//! pooling.
|
||||
//!
|
||||
//! ## Making POST requests (or setting request bodies)
|
||||
//! # Making POST requests (or setting request bodies)
|
||||
//!
|
||||
//! There are several ways you can set the body of a request. The basic one is
|
||||
//! by using the `body()` method of a [`RequestBuilder`](RequestBuilder). This lets you set the
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user