From 79f6cde3b1a56f6d154785bba22e3725831a59ea Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 25 Apr 2022 16:59:16 +0200 Subject: [PATCH] Update to tower-http 0.3.0 (#965) * Update to tower-http 0.3.0 * changelog link --- axum-extra/Cargo.toml | 2 +- axum/CHANGELOG.md | 2 ++ axum/Cargo.toml | 4 ++-- examples/consume-body-in-extractor-or-middleware/Cargo.toml | 2 +- examples/cors/Cargo.toml | 2 +- examples/cors/src/main.rs | 6 +++--- examples/key-value-store/Cargo.toml | 2 +- examples/multipart-form/Cargo.toml | 2 +- examples/sse/Cargo.toml | 2 +- examples/static-file-server/Cargo.toml | 2 +- examples/testing/Cargo.toml | 2 +- examples/todos/Cargo.toml | 2 +- examples/tracing-aka-logging/Cargo.toml | 2 +- examples/websockets/Cargo.toml | 2 +- 14 files changed, 18 insertions(+), 16 deletions(-) diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index 4a33f632..6381c994 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -24,7 +24,7 @@ http = "0.2" mime = "0.3" pin-project-lite = "0.2" tower = { version = "0.4", default_features = false, features = ["util"] } -tower-http = { version = "0.2", features = ["map-response-body"] } +tower-http = { version = "0.3", features = ["map-response-body"] } tower-layer = "0.3" tower-service = "0.3" diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 4326f953..46122495 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -10,9 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **added:** Add `response::ErrorResponse` and `response::Result` for `IntoResponse`-based error handling ([#921]) - **added:** Add `middleware::from_extractor` and deprecate `extract::extractor_middleware` ([#957]) +- **changed:** Update to tower-http 0.3 ([#965]) [#921]: https://github.com/tokio-rs/axum/pull/921 [#957]: https://github.com/tokio-rs/axum/pull/957 +[#965]: https://github.com/tokio-rs/axum/pull/965 # 0.5.3 (19. April, 2022) diff --git a/axum/Cargo.toml b/axum/Cargo.toml index 96a8d615..8fe8bb01 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -42,7 +42,7 @@ serde = "1.0" sync_wrapper = "0.1.1" tokio = { version = "1", features = ["time"] } tower = { version = "0.4.11", default-features = false, features = ["util", "buffer", "make"] } -tower-http = { version = "0.2.0", features = ["util", "map-response-body"] } +tower-http = { version = "0.3.0", features = ["util", "map-response-body"] } tower-layer = "0.3" tower-service = "0.3" @@ -81,7 +81,7 @@ features = [ ] [dev-dependencies.tower-http] -version = "0.2.0" +version = "0.3.0" features = ["full"] [package.metadata.docs.rs] diff --git a/examples/consume-body-in-extractor-or-middleware/Cargo.toml b/examples/consume-body-in-extractor-or-middleware/Cargo.toml index e501985f..a9694e1c 100644 --- a/examples/consume-body-in-extractor-or-middleware/Cargo.toml +++ b/examples/consume-body-in-extractor-or-middleware/Cargo.toml @@ -9,6 +9,6 @@ axum = { path = "../../axum" } hyper = "0.14" tokio = { version = "1.0", features = ["full"] } tower = "0.4" -tower-http = { version = "0.2", features = ["map-request-body", "util"] } +tower-http = { version = "0.3", features = ["map-request-body", "util"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/cors/Cargo.toml b/examples/cors/Cargo.toml index 004ba7e4..44fbd5ca 100644 --- a/examples/cors/Cargo.toml +++ b/examples/cors/Cargo.toml @@ -7,4 +7,4 @@ publish = false [dependencies] axum = { path = "../../axum" } tokio = { version = "1.0", features = ["full"] } -tower-http = { version = "0.2.0", features = ["cors"] } +tower-http = { version = "0.3.0", features = ["cors"] } diff --git a/examples/cors/src/main.rs b/examples/cors/src/main.rs index 28fa05f0..939b49d4 100644 --- a/examples/cors/src/main.rs +++ b/examples/cors/src/main.rs @@ -5,13 +5,13 @@ //! ``` use axum::{ - http::Method, + http::{HeaderValue, Method}, response::{Html, IntoResponse}, routing::get, Json, Router, }; use std::net::SocketAddr; -use tower_http::cors::{CorsLayer, Origin}; +use tower_http::cors::CorsLayer; #[tokio::main] async fn main() { @@ -29,7 +29,7 @@ async fn main() { // it is required to add ".allow_headers(vec![http::header::CONTENT_TYPE])" // or see this issue https://github.com/tokio-rs/axum/issues/849 CorsLayer::new() - .allow_origin(Origin::exact("http://localhost:3000".parse().unwrap())) + .allow_origin("http://localhost:3000".parse::().unwrap()) .allow_methods(vec![Method::GET]), ); serve(app, 4000).await; diff --git a/examples/key-value-store/Cargo.toml b/examples/key-value-store/Cargo.toml index e18a6489..b2ea5bf5 100644 --- a/examples/key-value-store/Cargo.toml +++ b/examples/key-value-store/Cargo.toml @@ -10,4 +10,4 @@ tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tower = { version = "0.4", features = ["util", "timeout", "load-shed", "limit"] } -tower-http = { version = "0.2.0", features = ["add-extension", "auth", "compression-full", "trace"] } +tower-http = { version = "0.3.0", features = ["add-extension", "auth", "compression-full", "trace"] } diff --git a/examples/multipart-form/Cargo.toml b/examples/multipart-form/Cargo.toml index c270f7ec..cf7d77b1 100644 --- a/examples/multipart-form/Cargo.toml +++ b/examples/multipart-form/Cargo.toml @@ -9,4 +9,4 @@ axum = { path = "../../axum", features = ["multipart"] } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tower-http = { version = "0.2.0", features = ["trace"] } +tower-http = { version = "0.3.0", features = ["trace"] } diff --git a/examples/sse/Cargo.toml b/examples/sse/Cargo.toml index e9df22a5..f119d63a 100644 --- a/examples/sse/Cargo.toml +++ b/examples/sse/Cargo.toml @@ -9,7 +9,7 @@ axum = { path = "../../axum", features = ["headers"] } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tower-http = { version = "0.2.0", features = ["fs", "trace"] } +tower-http = { version = "0.3.0", features = ["fs", "trace"] } futures = "0.3" tokio-stream = "0.1" headers = "0.3" diff --git a/examples/static-file-server/Cargo.toml b/examples/static-file-server/Cargo.toml index af39d550..d927ec97 100644 --- a/examples/static-file-server/Cargo.toml +++ b/examples/static-file-server/Cargo.toml @@ -9,4 +9,4 @@ axum = { path = "../../axum" } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tower-http = { version = "0.2.0", features = ["fs", "trace"] } +tower-http = { version = "0.3.0", features = ["fs", "trace"] } diff --git a/examples/testing/Cargo.toml b/examples/testing/Cargo.toml index 30ff33c4..e70223b5 100644 --- a/examples/testing/Cargo.toml +++ b/examples/testing/Cargo.toml @@ -10,7 +10,7 @@ mime = "0.3" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tower-http = { version = "0.2.0", features = ["trace"] } +tower-http = { version = "0.3.0", features = ["trace"] } serde_json = "1.0" hyper = { version = "0.14", features = ["full"] } diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml index 896d2f7a..debc10a9 100644 --- a/examples/todos/Cargo.toml +++ b/examples/todos/Cargo.toml @@ -10,6 +10,6 @@ tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tower = { version = "0.4", features = ["util", "timeout"] } -tower-http = { version = "0.2.0", features = ["add-extension", "trace"] } +tower-http = { version = "0.3.0", features = ["add-extension", "trace"] } uuid = { version = "0.8", features = ["serde", "v4"] } serde = { version = "1.0", features = ["derive"] } diff --git a/examples/tracing-aka-logging/Cargo.toml b/examples/tracing-aka-logging/Cargo.toml index 4def1c16..a64f798b 100644 --- a/examples/tracing-aka-logging/Cargo.toml +++ b/examples/tracing-aka-logging/Cargo.toml @@ -9,4 +9,4 @@ axum = { path = "../../axum" } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tower-http = { version = "0.2.0", features = ["trace"] } +tower-http = { version = "0.3.0", features = ["trace"] } diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 7d2ae9fe..67935f3c 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -9,5 +9,5 @@ axum = { path = "../../axum", features = ["ws", "headers"] } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tower-http = { version = "0.2.0", features = ["fs", "trace"] } +tower-http = { version = "0.3.0", features = ["fs", "trace"] } headers = "0.3"