Skip to content

Commit 19f9024

Browse files
committed
feat(body): remove Body::is_empty()
BREAKING CHANGE: `Body::is_empty()` is gone. Replace with `Body::is_end_stream()`, from the `Payload` trait.
1 parent 2051d5c commit 19f9024

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

src/body.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -224,24 +224,6 @@ impl Body {
224224
Body::new(Kind::Wrapped(Box::new(mapped)))
225225
}
226226

227-
/// Returns if this body was constructed via `Body::empty()`.
228-
///
229-
/// # Note
230-
///
231-
/// This does **not** detect if the body stream may be at the end, or
232-
/// if the stream will not yield any chunks, in all cases. For instance,
233-
/// a streaming body using `chunked` encoding is not able to tell if
234-
/// there are more chunks immediately.
235-
///
236-
/// See [`is_end_stream`](Payload::is_end_stream) for a dynamic version.
237-
#[inline]
238-
pub fn is_empty(&self) -> bool {
239-
match self.kind {
240-
Kind::Empty => true,
241-
_ => false,
242-
}
243-
}
244-
245227
fn new(kind: Kind) -> Body {
246228
Body {
247229
kind: kind,

src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ where C: Connect + Sync + 'static,
370370
// It won't be ready if there is a body to stream.
371371
if ver == Ver::Http2 || !pooled.is_pool_enabled() || pooled.is_ready() {
372372
drop(pooled);
373-
} else if !res.body().is_empty() {
373+
} else if !res.body().is_end_stream() {
374374
let (delayed_tx, delayed_rx) = oneshot::channel();
375375
res.body_mut().delayed_eof(delayed_rx);
376376
executor.execute(

0 commit comments

Comments
 (0)