Update to tower-http 0.4 (#1783)

This commit is contained in:
David Pedersen
2023-02-24 20:51:30 +00:00
committed by GitHub
parent 6a4825bb22
commit f726f16b6d
28 changed files with 131 additions and 193 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ publish = false
axum = { path = "../../axum" }
tokio = { version = "1.0", features = ["full"] }
tower = { version = "0.4", features = ["util", "timeout", "load-shed", "limit"] }
tower-http = { version = "0.3.0", features = [
tower-http = { version = "0.4.0", features = [
"add-extension",
"auth",
"compression-full",
+3 -3
View File
@@ -25,8 +25,8 @@ use std::{
};
use tower::{BoxError, ServiceBuilder};
use tower_http::{
auth::RequireAuthorizationLayer, compression::CompressionLayer, limit::RequestBodyLimitLayer,
trace::TraceLayer,
compression::CompressionLayer, limit::RequestBodyLimitLayer, trace::TraceLayer,
validate_request::ValidateRequestHeaderLayer,
};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
@@ -128,7 +128,7 @@ fn admin_routes() -> Router<SharedState> {
.route("/keys", delete(delete_all_keys))
.route("/key/:key", delete(remove_key))
// Require bearer auth for all admin routes
.layer(RequireAuthorizationLayer::bearer("secret-token"))
.layer(ValidateRequestHeaderLayer::bearer("secret-token"))
}
async fn handle_error(error: BoxError) -> impl IntoResponse {