fix(web): fix compilation (#670)
Make tonic::body::empty_body public and use it instead of the old and non existant anymore BoxBody::empty()
This commit is contained in:
@@ -2,7 +2,7 @@ use std::task::{Context, Poll};
|
|||||||
|
|
||||||
use http::{header, HeaderMap, HeaderValue, Method, Request, Response, StatusCode, Version};
|
use http::{header, HeaderMap, HeaderValue, Method, Request, Response, StatusCode, Version};
|
||||||
use hyper::Body;
|
use hyper::Body;
|
||||||
use tonic::body::BoxBody;
|
use tonic::body::{BoxBody, empty_body};
|
||||||
use tonic::transport::NamedService;
|
use tonic::transport::NamedService;
|
||||||
use tower_service::Service;
|
use tower_service::Service;
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
@@ -65,7 +65,7 @@ where
|
|||||||
fn no_content(&self, headers: HeaderMap) -> BoxFuture<S::Response, S::Error> {
|
fn no_content(&self, headers: HeaderMap) -> BoxFuture<S::Response, S::Error> {
|
||||||
let mut res = Response::builder()
|
let mut res = Response::builder()
|
||||||
.status(StatusCode::NO_CONTENT)
|
.status(StatusCode::NO_CONTENT)
|
||||||
.body(BoxBody::empty())
|
.body(empty_body())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
res.headers_mut().extend(headers);
|
res.headers_mut().extend(headers);
|
||||||
@@ -77,7 +77,7 @@ where
|
|||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
Ok(Response::builder()
|
Ok(Response::builder()
|
||||||
.status(status)
|
.status(status)
|
||||||
.body(BoxBody::empty())
|
.body(empty_body())
|
||||||
.unwrap())
|
.unwrap())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ pub type BoxBody = http_body::combinators::BoxBody<bytes::Bytes, crate::Status>;
|
|||||||
|
|
||||||
// this also exists in `crate::codegen` but we need it here since `codegen` has
|
// this also exists in `crate::codegen` but we need it here since `codegen` has
|
||||||
// `#[cfg(feature = "codegen")]`.
|
// `#[cfg(feature = "codegen")]`.
|
||||||
pub(crate) fn empty_body() -> BoxBody {
|
/// Create an empty `BoxBody`
|
||||||
|
pub fn empty_body() -> BoxBody {
|
||||||
http_body::Empty::new().map_err(|err| match err {}).boxed()
|
http_body::Empty::new().map_err(|err| match err {}).boxed()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user