Merge branch 'master' into sleep_on_errors
This commit is contained in:
@@ -49,6 +49,22 @@ impl Body {
|
||||
let (tx, rx) = channel();
|
||||
(tx.tx, rx)
|
||||
}
|
||||
|
||||
/// Returns if this body was constructed via `Body::empty()`.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This does **not** detect if the body stream may be at the end, or
|
||||
/// if the stream will not yield any chunks, in all cases. For instance,
|
||||
/// a streaming body using `chunked` encoding is not able to tell if
|
||||
/// there are more chunks immediately.
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
match self.0 {
|
||||
Inner::Empty => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
|
||||
@@ -58,6 +58,10 @@ impl<B> Request<B> {
|
||||
#[inline]
|
||||
pub fn body_ref(&self) -> Option<&B> { self.body.as_ref() }
|
||||
|
||||
/// Get a mutable reference to the Request body.
|
||||
#[inline]
|
||||
pub fn body_mut(&mut self) -> &mut Option<B> { &mut self.body }
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
#[deprecated(since="0.11.12", note="This method will be gone in future versions.")]
|
||||
|
||||
Reference in New Issue
Block a user