chore: update to axum 0.5 (#953)

This commit is contained in:
David Pedersen
2022-03-31 21:57:16 +02:00
committed by GitHub
parent d4bd4758dd
commit d142e1aa4c
2 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ tokio = {version = "1.0.1", features = ["net"], optional = true}
tokio-stream = "0.1"
tower = {version = "0.4.7", features = ["balance", "buffer", "discover", "limit", "load", "make", "timeout", "util"], optional = true}
tracing-futures = {version = "0.2", optional = true}
axum = {version = "0.4", default_features = false, optional = true}
axum = {version = "0.5", default_features = false, optional = true}
# rustls
rustls-pemfile = { version = "0.3", optional = true }
+9 -4
View File
@@ -8,6 +8,7 @@ use hyper::Body;
use pin_project::pin_project;
use std::{
convert::Infallible,
fmt,
future::Future,
pin::Pin,
task::{Context, Poll},
@@ -54,8 +55,7 @@ impl Routes {
async fn unimplemented() -> impl axum::response::IntoResponse {
let status = http::StatusCode::OK;
let headers =
axum::response::Headers([("grpc-status", "12"), ("content-type", "application/grpc")]);
let headers = [("grpc-status", "12"), ("content-type", "application/grpc")];
(status, headers)
}
@@ -75,8 +75,13 @@ impl Service<Request<Body>> for Routes {
}
#[pin_project]
#[derive(Debug)]
pub struct RoutesFuture(#[pin] axum::routing::future::RouterFuture<Body>);
pub struct RoutesFuture(#[pin] axum::routing::future::RouteFuture<Body, Infallible>);
impl fmt::Debug for RoutesFuture {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("RoutesFuture").finish()
}
}
impl Future for RoutesFuture {
type Output = Result<Response<BoxBody>, crate::Error>;