mirror of
https://github.com/openharmony/third_party_rust_http-body.git
synced 2026-07-21 01:25:37 -04:00
Correctly override size_hint and is_end_stream for Empty (#42)
I noticed this while working on https://github.com/hyperium/tonic/pull/622 as it broke some interop tests.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Unreleased
|
||||
|
||||
Nothing.
|
||||
- Correctly override `Body::size_hint` and `Body::is_end_stream` for `Empty`.
|
||||
|
||||
# 0.4.1 (March 18, 2021)
|
||||
|
||||
|
||||
+9
-1
@@ -1,4 +1,4 @@
|
||||
use super::Body;
|
||||
use super::{Body, SizeHint};
|
||||
use bytes::Buf;
|
||||
use http::HeaderMap;
|
||||
use std::{
|
||||
@@ -40,6 +40,14 @@ impl<D: Buf> Body for Empty<D> {
|
||||
) -> Poll<Result<Option<HeaderMap>, Self::Error>> {
|
||||
Poll::Ready(Ok(None))
|
||||
}
|
||||
|
||||
fn is_end_stream(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> SizeHint {
|
||||
SizeHint::with_exact(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl<D> fmt::Debug for Empty<D> {
|
||||
|
||||
Reference in New Issue
Block a user