tonic/
body.rs

1//! HTTP specific body utilities.
2
3use http_body::Body;
4
5/// A type erased HTTP body used for tonic services.
6pub type BoxBody = http_body::combinators::UnsyncBoxBody<bytes::Bytes, crate::Status>;
7
8// this also exists in `crate::codegen` but we need it here since `codegen` has
9// `#[cfg(feature = "codegen")]`.
10/// Create an empty `BoxBody`
11pub fn empty_body() -> BoxBody {
12    http_body::Empty::new()
13        .map_err(|err| match err {})
14        .boxed_unsync()
15}