Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to axum 0.5 #953

Merged
merged 1 commit into from Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tonic/Cargo.toml
Expand Up @@ -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 }
Expand Down
13 changes: 9 additions & 4 deletions tonic/src/transport/service/router.rs
Expand Up @@ -8,6 +8,7 @@ use hyper::Body;
use pin_project::pin_project;
use std::{
convert::Infallible,
fmt,
future::Future,
pin::Pin,
task::{Context, Poll},
Expand Down Expand Up @@ -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)
}

Expand All @@ -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>;
Expand Down