Update to tower-http 0.3.0 (#965)

* Update to tower-http 0.3.0

* changelog link
This commit is contained in:
David Pedersen 2022-04-25 16:59:16 +02:00 committed by GitHub
parent ebecac57a3
commit 79f6cde3b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 18 additions and 16 deletions

View file

@ -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"

View file

@ -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)

View file

@ -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]

View file

@ -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"] }

View file

@ -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"] }

View file

@ -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::<HeaderValue>().unwrap())
.allow_methods(vec![Method::GET]),
);
serve(app, 4000).await;

View file

@ -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"] }

View file

@ -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"] }

View file

@ -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"

View file

@ -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"] }

View file

@ -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"] }

View file

@ -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"] }

View file

@ -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"] }

View file

@ -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"