1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::BoxError;
use crate::Error;
mod stream_body;
pub use self::stream_body::StreamBody;
#[doc(no_inline)]
pub use http_body::{Body as HttpBody, Empty, Full};
#[doc(no_inline)]
pub use hyper::body::Body;
#[doc(no_inline)]
pub use bytes::Bytes;
pub type BoxBody = http_body::combinators::UnsyncBoxBody<Bytes, Error>;
pub fn box_body<B>(body: B) -> BoxBody
where
B: http_body::Body<Data = Bytes> + Send + 'static,
B::Error: Into<BoxError>,
{
body.map_err(Error::new).boxed_unsync()
}
pub(crate) fn empty() -> BoxBody {
box_body(http_body::Empty::new())
}