diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md index ff374e86..6ec5248e 100644 --- a/ECOSYSTEM.md +++ b/ECOSYSTEM.md @@ -28,7 +28,6 @@ If your project isn't listed here and you would like it to be, please feel free - [aide](https://docs.rs/aide): Code-first Open API documentation generator with [axum integration](https://docs.rs/aide/latest/aide/axum/index.html). - [axum-typed-routing](https://docs.rs/axum-typed-routing/latest/axum_typed_routing/): Statically typed routing macros with OpenAPI generation using aide. - [axum-jsonschema](https://docs.rs/axum-jsonschema/): A `Json` extractor that does JSON schema validation of requests. -- [tower-sessions](https://docs.rs/tower-sessions): Cookie-based sessions. - [axum-login](https://docs.rs/axum-login): Session-based user authentication for axum. - [axum-csrf-sync-pattern](https://crates.io/crates/axum-csrf-sync-pattern): A middleware implementing CSRF STP for AJAX backends and API endpoints. - [axum-otel-metrics](https://github.com/ttys3/axum-otel-metrics/): A axum OpenTelemetry Metrics middleware with prometheus exporter supported. @@ -105,6 +104,7 @@ If your project isn't listed here and you would like it to be, please feel free - [Introduction to axum]: YouTube playlist - [Rust Axum Full Course]: YouTube video - [Deploying Axum projects with Shuttle] +- [API Development with Rust](https://rust-api.dev/docs/front-matter/preface/): REST APIs based on Axum [axum-tutorial]: https://github.com/programatik29/axum-tutorial [axum-tutorial-website]: https://programatik29.github.io/axum-tutorial/ diff --git a/axum-core/CHANGELOG.md b/axum-core/CHANGELOG.md index 464ee314..dc1b9ed5 100644 --- a/axum-core/CHANGELOG.md +++ b/axum-core/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# 0.4.5 + +- **fixed:** Compile errors from the internal `__log_rejection` macro under + certain Cargo feature combinations between axum crates ([#2933]) + +[#2933]: https://github.com/tokio-rs/axum/pull/2933 + # 0.4.4 - **added:** Derive `Clone` and `Copy` for `AppendHeaders` ([#2776]) diff --git a/axum-core/Cargo.toml b/axum-core/Cargo.toml index e9eaca03..a7b1bc62 100644 --- a/axum-core/Cargo.toml +++ b/axum-core/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" name = "axum-core" readme = "README.md" repository = "https://github.com/tokio-rs/axum" -version = "0.4.4" # remember to also bump the version that axum and axum-extra depend on +version = "0.4.5" # remember to also bump the version that axum and axum-extra depend on [features] tracing = ["dep:tracing"] @@ -54,6 +54,9 @@ allowed = [ "http_body", ] +[package.metadata.cargo-machete] +ignored = ["tower-http"] # See __private_docs feature + [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] diff --git a/axum-core/src/lib.rs b/axum-core/src/lib.rs index cd1dc2ee..134c566b 100644 --- a/axum-core/src/lib.rs +++ b/axum-core/src/lib.rs @@ -50,6 +50,11 @@ #[macro_use] pub(crate) mod macros; +#[doc(hidden)] // macro helpers +pub mod __private { + #[cfg(feature = "tracing")] + pub use tracing; +} mod error; mod ext_traits; diff --git a/axum-core/src/macros.rs b/axum-core/src/macros.rs index 7d723818..aa99ba40 100644 --- a/axum-core/src/macros.rs +++ b/axum-core/src/macros.rs @@ -9,12 +9,12 @@ macro_rules! __log_rejection { status = $status:expr, ) => { { - tracing::event!( + $crate::__private::tracing::event!( target: "axum::rejection", - tracing::Level::TRACE, + $crate::__private::tracing::Level::TRACE, status = $status.as_u16(), body = $body_text, - rejection_type = std::any::type_name::<$ty>(), + rejection_type = ::std::any::type_name::<$ty>(), "rejecting request", ); } diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index bf0ba2a4..00c9f7af 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -34,13 +34,13 @@ json-lines = [ multipart = ["dep:multer"] protobuf = ["dep:prost"] query = ["dep:serde_html_form"] -tracing = ["dep:tracing", "axum-core/tracing", "axum/tracing"] +tracing = ["axum-core/tracing", "axum/tracing"] typed-header = ["dep:headers"] typed-routing = ["dep:axum-macros", "dep:percent-encoding", "dep:serde_html_form", "dep:form_urlencoded"] [dependencies] -axum = { path = "../axum", version = "0.7.6", default-features = false } -axum-core = { path = "../axum-core", version = "0.4.4" } +axum = { path = "../axum", version = "0.7.7", default-features = false } +axum-core = { path = "../axum-core", version = "0.4.5" } bytes = "1.1.0" futures-util = { version = "0.3", default-features = false, features = ["alloc"] } http = "1.0.0" diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 624ff6e2..1e07d7ea 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# Unreleased + +- **breaking:** The tuple and tuple_struct `Path` extractor deserializers now check that the number of parameters matches the tuple length exactly ([#2931]) + +[#2931]: https://github.com/tokio-rs/axum/pull/2931 + +# 0.7.7 + +- **change**: Remove manual tables of content from the documentation, since + rustdoc now generates tables of content in the sidebar ([#2921]) + +[#2921]: https://github.com/tokio-rs/axum/pull/2921 + # 0.7.6 - **change:** Avoid cloning `Arc` during deserialization of `Path` diff --git a/axum/Cargo.toml b/axum/Cargo.toml index fd66a8b6..0a6fe0bb 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "axum" -version = "0.7.6" +version = "0.7.7" categories = ["asynchronous", "network-programming", "web-programming::http-server"] description = "Web framework that focuses on ergonomics and modularity" edition = "2021" @@ -41,7 +41,7 @@ ws = ["dep:hyper", "tokio", "dep:tokio-tungstenite", "dep:sha1", "dep:base64"] __private_docs = ["tower/full", "dep:tower-http"] [dependencies] -axum-core = { path = "../axum-core", version = "0.4.4" } +axum-core = { path = "../axum-core", version = "0.4.5" } bytes = "1.0" futures-util = { version = "0.3", default-features = false, features = ["alloc"] } http = "1.0.0" @@ -62,7 +62,7 @@ tower-service = "0.3" # optional dependencies axum-macros = { path = "../axum-macros", version = "0.4.2", optional = true } -base64 = { version = "0.21.0", optional = true } +base64 = { version = "0.22.1", optional = true } hyper = { version = "1.1.0", optional = true } hyper-util = { version = "0.1.3", features = ["tokio", "server", "service"], optional = true } multer = { version = "3.0.0", optional = true } @@ -71,7 +71,7 @@ serde_path_to_error = { version = "0.1.8", optional = true } serde_urlencoded = { version = "0.7", optional = true } sha1 = { version = "0.10", optional = true } tokio = { package = "tokio", version = "1.25.0", features = ["time"], optional = true } -tokio-tungstenite = { version = "0.23", optional = true } +tokio-tungstenite = { version = "0.24.0", optional = true } tracing = { version = "0.1", default-features = false, optional = true } [dependencies.tower-http] @@ -120,7 +120,7 @@ serde_json = "1.0" time = { version = "0.3", features = ["serde-human-readable"] } tokio = { package = "tokio", version = "1.25.0", features = ["macros", "rt", "rt-multi-thread", "net", "test-util"] } tokio-stream = "0.1" -tokio-tungstenite = "0.23" +tokio-tungstenite = "0.24.0" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["json"] } uuid = { version = "1.0", features = ["serde", "v4"] } diff --git a/axum/src/docs/error_handling.md b/axum/src/docs/error_handling.md index 6993b29a..7d7e14ee 100644 --- a/axum/src/docs/error_handling.md +++ b/axum/src/docs/error_handling.md @@ -1,12 +1,5 @@ Error handling model and utilities -# Table of contents - -- [axum's error handling model](#axums-error-handling-model) -- [Routing to fallible services](#routing-to-fallible-services) -- [Applying fallible middleware](#applying-fallible-middleware) -- [Running extractors for error handling](#running-extractors-for-error-handling) - # axum's error handling model axum is based on [`tower::Service`] which bundles errors through its associated diff --git a/axum/src/docs/extract.md b/axum/src/docs/extract.md index 12e03697..4f52a3ad 100644 --- a/axum/src/docs/extract.md +++ b/axum/src/docs/extract.md @@ -1,20 +1,5 @@ Types and traits for extracting data from requests. -# Table of contents - -- [Intro](#intro) -- [Common extractors](#common-extractors) -- [Applying multiple extractors](#applying-multiple-extractors) -- [The order of extractors](#the-order-of-extractors) -- [Optional extractors](#optional-extractors) -- [Customizing extractor responses](#customizing-extractor-responses) -- [Accessing inner errors](#accessing-inner-errors) -- [Defining custom extractors](#defining-custom-extractors) -- [Accessing other extractors in `FromRequest` or `FromRequestParts` implementations](#accessing-other-extractors-in-fromrequest-or-fromrequestparts-implementations) -- [Request body limits](#request-body-limits) -- [Wrapping extractors](#wrapping-extractors) -- [Logging rejections](#logging-rejections) - # Intro A handler function is an async function that takes any number of diff --git a/axum/src/docs/middleware.md b/axum/src/docs/middleware.md index 85731414..3a902372 100644 --- a/axum/src/docs/middleware.md +++ b/axum/src/docs/middleware.md @@ -1,15 +1,3 @@ -# Table of contents - -- [Intro](#intro) -- [Applying middleware](#applying-middleware) -- [Commonly used middleware](#commonly-used-middleware) -- [Ordering](#ordering) -- [Writing middleware](#writing-middleware) -- [Routing to services/middleware and backpressure](#routing-to-servicesmiddleware-and-backpressure) -- [Accessing state in middleware](#accessing-state-in-middleware) -- [Passing state from middleware to handlers](#passing-state-from-middleware-to-handlers) -- [Rewriting request URI in middleware](#rewriting-request-uri-in-middleware) - # Intro axum is unique in that it doesn't have its own bespoke middleware system and diff --git a/axum/src/docs/response.md b/axum/src/docs/response.md index 67695632..c0974fb6 100644 --- a/axum/src/docs/response.md +++ b/axum/src/docs/response.md @@ -1,11 +1,5 @@ Types and traits for generating responses. -# Table of contents - -- [Building responses](#building-responses) -- [Returning different response types](#returning-different-response-types) -- [Regarding `impl IntoResponse`](#regarding-impl-intoresponse) - # Building responses Anything that implements [`IntoResponse`] can be returned from a handler. axum diff --git a/axum/src/docs/routing/fallback.md b/axum/src/docs/routing/fallback.md index 27fb76a5..a864b7a4 100644 --- a/axum/src/docs/routing/fallback.md +++ b/axum/src/docs/routing/fallback.md @@ -23,7 +23,11 @@ async fn fallback(uri: Uri) -> (StatusCode, String) { Fallbacks only apply to routes that aren't matched by anything in the router. If a handler is matched by a request but returns 404 the -fallback is not called. +fallback is not called. Note that this applies to [`MethodRouter`]s too: if the +request hits a valid path but the [`MethodRouter`] does not have an appropriate +method handler installed, the fallback is not called (use +[`MethodRouter::fallback`] for this purpose instead). + # Handling all requests without other routes diff --git a/axum/src/docs/routing/nest.md b/axum/src/docs/routing/nest.md index 3151729e..845072f0 100644 --- a/axum/src/docs/routing/nest.md +++ b/axum/src/docs/routing/nest.md @@ -82,6 +82,11 @@ let app = Router::new() # let _: Router = app; ``` +Additionally, while the wildcard route `/foo/*rest` will not match the +paths `/foo` or `/foo/`, a nested router at `/foo` will match the path `/foo` +(but not `/foo/`), and a nested router at `/foo/` will match the path `/foo/` +(but not `/foo`). + # Fallbacks If a nested router doesn't have its own fallback then it will inherit the diff --git a/axum/src/extract/path/de.rs b/axum/src/extract/path/de.rs index 8ba8a431..2d0b04f5 100644 --- a/axum/src/extract/path/de.rs +++ b/axum/src/extract/path/de.rs @@ -140,7 +140,7 @@ impl<'de> Deserializer<'de> for PathDeserializer<'de> { where V: Visitor<'de>, { - if self.url_params.len() < len { + if self.url_params.len() != len { return Err(PathDeserializationError::wrong_number_of_parameters() .got(self.url_params.len()) .expected(len)); @@ -160,7 +160,7 @@ impl<'de> Deserializer<'de> for PathDeserializer<'de> { where V: Visitor<'de>, { - if self.url_params.len() < len { + if self.url_params.len() != len { return Err(PathDeserializationError::wrong_number_of_parameters() .got(self.url_params.len()) .expected(len)); @@ -773,20 +773,6 @@ mod tests { ); } - #[test] - fn test_parse_tuple_ignoring_additional_fields() { - let url_params = create_url_params(vec![ - ("a", "abc"), - ("b", "true"), - ("c", "1"), - ("d", "false"), - ]); - assert_eq!( - <(&str, bool, u32)>::deserialize(PathDeserializer::new(&url_params)).unwrap(), - ("abc", true, 1) - ); - } - #[test] fn test_parse_map() { let url_params = create_url_params(vec![("a", "1"), ("b", "true"), ("c", "abc")]); @@ -813,6 +799,18 @@ mod tests { }; } + #[test] + fn test_parse_tuple_too_many_fields() { + test_parse_error!( + vec![("a", "abc"), ("b", "true"), ("c", "1"), ("d", "false"),], + (&str, bool, u32), + ErrorKind::WrongNumberOfParameters { + got: 4, + expected: 3, + } + ); + } + #[test] fn test_wrong_number_of_parameters_error() { test_parse_error!( diff --git a/axum/src/extract/path/mod.rs b/axum/src/extract/path/mod.rs index 44898431..d6b9fb12 100644 --- a/axum/src/extract/path/mod.rs +++ b/axum/src/extract/path/mod.rs @@ -744,6 +744,33 @@ mod tests { ); } + #[crate::test] + async fn tuple_param_matches_exactly() { + #[allow(dead_code)] + #[derive(Deserialize)] + struct Tuple(String, String); + + let app = Router::new() + .route("/foo/:a/:b/:c", get(|_: Path<(String, String)>| async {})) + .route("/bar/:a/:b/:c", get(|_: Path| async {})); + + let client = TestClient::new(app); + + let res = client.get("/foo/a/b/c").await; + assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR); + assert_eq!( + res.text().await, + "Wrong number of path arguments for `Path`. Expected 2 but got 3", + ); + + let res = client.get("/bar/a/b/c").await; + assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR); + assert_eq!( + res.text().await, + "Wrong number of path arguments for `Path`. Expected 2 but got 3", + ); + } + #[crate::test] async fn deserialize_into_vec_of_tuples() { let app = Router::new().route( diff --git a/axum/src/lib.rs b/axum/src/lib.rs index 21c4b6ee..64d4a6a2 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -1,22 +1,5 @@ //! axum is a web application framework that focuses on ergonomics and modularity. //! -//! # Table of contents -//! -//! - [High-level features](#high-level-features) -//! - [Compatibility](#compatibility) -//! - [Example](#example) -//! - [Routing](#routing) -//! - [Handlers](#handlers) -//! - [Extractors](#extractors) -//! - [Responses](#responses) -//! - [Error handling](#error-handling) -//! - [Middleware](#middleware) -//! - [Sharing state with handlers](#sharing-state-with-handlers) -//! - [Building integrations for axum](#building-integrations-for-axum) -//! - [Required dependencies](#required-dependencies) -//! - [Examples](#examples) -//! - [Feature flags](#feature-flags) -//! //! # High-level features //! //! - Route requests to handlers with a macro-free API. diff --git a/axum/src/routing/tests/mod.rs b/axum/src/routing/tests/mod.rs index 144c870d..e9ab56e1 100644 --- a/axum/src/routing/tests/mod.rs +++ b/axum/src/routing/tests/mod.rs @@ -966,7 +966,7 @@ async fn logging_rejections() { rejection_type: String, } - let events = capture_tracing::(|| async { + let events = capture_tracing::(|| async { let app = Router::new() .route("/extension", get(|_: Extension| async {})) .route("/string", post(|_: String| async {})); @@ -987,6 +987,7 @@ async fn logging_rejections() { StatusCode::BAD_REQUEST, ); }) + .with_filter("axum::rejection=trace") .await; assert_eq!( diff --git a/axum/src/serve.rs b/axum/src/serve.rs index e2b974cf..1ba9a145 100644 --- a/axum/src/serve.rs +++ b/axum/src/serve.rs @@ -213,61 +213,8 @@ where type IntoFuture = private::ServeFuture; fn into_future(self) -> Self::IntoFuture { - private::ServeFuture(Box::pin(async move { - let Self { - tcp_listener, - mut make_service, - tcp_nodelay, - _marker: _, - } = self; - - loop { - let (tcp_stream, remote_addr) = match tcp_accept(&tcp_listener).await { - Some(conn) => conn, - None => continue, - }; - - if let Some(nodelay) = tcp_nodelay { - if let Err(err) = tcp_stream.set_nodelay(nodelay) { - trace!("failed to set TCP_NODELAY on incoming connection: {err:#}"); - } - } - - let tcp_stream = TokioIo::new(tcp_stream); - - poll_fn(|cx| make_service.poll_ready(cx)) - .await - .unwrap_or_else(|err| match err {}); - - let tower_service = make_service - .call(IncomingStream { - tcp_stream: &tcp_stream, - remote_addr, - }) - .await - .unwrap_or_else(|err| match err {}) - .map_request(|req: Request| req.map(Body::new)); - - let hyper_service = TowerToHyperService::new(tower_service); - - tokio::spawn(async move { - match Builder::new(TokioExecutor::new()) - // upgrades needed for websockets - .serve_connection_with_upgrades(tcp_stream, hyper_service) - .await - { - Ok(()) => {} - Err(_err) => { - // This error only appears when the client doesn't send a request and - // terminate the connection. - // - // If client sends one request then terminate connection whenever, it doesn't - // appear. - } - } - }); - } - })) + self.with_graceful_shutdown(std::future::pending()) + .into_future() } } diff --git a/axum/src/test_helpers/tracing_helpers.rs b/axum/src/test_helpers/tracing_helpers.rs index 2240717e..96abe510 100644 --- a/axum/src/test_helpers/tracing_helpers.rs +++ b/axum/src/test_helpers/tracing_helpers.rs @@ -1,7 +1,14 @@ use crate::util::AxumMutex; -use std::{future::Future, io, sync::Arc}; +use std::{ + future::{Future, IntoFuture}, + io, + marker::PhantomData, + pin::Pin, + sync::Arc, +}; use serde::{de::DeserializeOwned, Deserialize}; +use tracing::instrument::WithSubscriber; use tracing_subscriber::prelude::*; use tracing_subscriber::{filter::Targets, fmt::MakeWriter}; @@ -14,36 +21,69 @@ pub(crate) struct TracingEvent { } /// Run an async closure and capture the tracing output it produces. -pub(crate) async fn capture_tracing(f: F) -> Vec> +pub(crate) fn capture_tracing(f: F) -> CaptureTracing where - F: Fn() -> Fut, - Fut: Future, T: DeserializeOwned, { - let (make_writer, handle) = TestMakeWriter::new(); + CaptureTracing { + f, + filter: None, + _phantom: PhantomData, + } +} - let subscriber = tracing_subscriber::registry().with( - tracing_subscriber::fmt::layer() - .with_writer(make_writer) - .with_target(true) - .without_time() - .with_ansi(false) - .json() - .flatten_event(false) - .with_filter("axum=trace".parse::().unwrap()), - ); +pub(crate) struct CaptureTracing { + f: F, + filter: Option, + _phantom: PhantomData T>, +} - let guard = tracing::subscriber::set_default(subscriber); +impl CaptureTracing { + pub(crate) fn with_filter(mut self, filter_string: &str) -> Self { + self.filter = Some(filter_string.parse().unwrap()); + self + } +} - f().await; +impl IntoFuture for CaptureTracing +where + F: Fn() -> Fut + Send + Sync + 'static, + Fut: Future + Send, + T: DeserializeOwned, +{ + type Output = Vec>; + type IntoFuture = Pin + Send>>; - drop(guard); + fn into_future(self) -> Self::IntoFuture { + let Self { f, filter, .. } = self; + Box::pin(async move { + let (make_writer, handle) = TestMakeWriter::new(); - handle - .take() - .lines() - .map(|line| serde_json::from_str(line).unwrap()) - .collect() + let filter = filter.unwrap_or_else(|| "axum=trace".parse().unwrap()); + let subscriber = tracing_subscriber::registry().with( + tracing_subscriber::fmt::layer() + .with_writer(make_writer) + .with_target(true) + .without_time() + .with_ansi(false) + .json() + .flatten_event(false) + .with_filter(filter), + ); + + let guard = tracing::subscriber::set_default(subscriber); + + f().with_current_subscriber().await; + + drop(guard); + + handle + .take() + .lines() + .map(|line| serde_json::from_str(line).unwrap()) + .collect() + }) + } } struct TestMakeWriter { diff --git a/examples/chat/Cargo.toml b/examples/chat/Cargo.toml index 90d88246..2beb99cf 100644 --- a/examples/chat/Cargo.toml +++ b/examples/chat/Cargo.toml @@ -8,6 +8,5 @@ publish = false axum = { path = "../../axum", features = ["ws"] } futures = "0.3" tokio = { version = "1", features = ["full"] } -tower = { version = "0.4", features = ["util"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/compression/Cargo.toml b/examples/compression/Cargo.toml index d5fdcf8e..a65d9d0d 100644 --- a/examples/compression/Cargo.toml +++ b/examples/compression/Cargo.toml @@ -6,17 +6,16 @@ publish = false [dependencies] axum = { path = "../../axum" } -axum-extra = { path = "../../axum-extra", features = ["typed-header"] } serde_json = "1" tokio = { version = "1", features = ["macros", "rt-multi-thread"] } -tower = "0.4" -tower-http = { version = "0.5", features = ["compression-full", "decompression-full"] } +tower = "0.5.1" +tower-http = { version = "0.6.1", features = ["compression-full", "decompression-full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } [dev-dependencies] assert-json-diff = "2.0" -brotli = "3.4" +brotli = "6.0" flate2 = "1" http = "1" zstd = "0.13" diff --git a/examples/consume-body-in-extractor-or-middleware/Cargo.toml b/examples/consume-body-in-extractor-or-middleware/Cargo.toml index 9aeb864d..66885885 100644 --- a/examples/consume-body-in-extractor-or-middleware/Cargo.toml +++ b/examples/consume-body-in-extractor-or-middleware/Cargo.toml @@ -7,9 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum" } http-body-util = "0.1.0" -hyper = "1.0.0" tokio = { version = "1.0", features = ["full"] } -tower = "0.4" -tower-http = { version = "0.5.0", 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 5d5d2eda..654538fa 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.5.0", features = ["cors"] } +tower-http = { version = "0.6.1", features = ["cors"] } diff --git a/examples/customize-path-rejection/Cargo.toml b/examples/customize-path-rejection/Cargo.toml index 8f5b1e44..c1c4884d 100644 --- a/examples/customize-path-rejection/Cargo.toml +++ b/examples/customize-path-rejection/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum" } serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/diesel-async-postgres/Cargo.toml b/examples/diesel-async-postgres/Cargo.toml index d86db151..efec3440 100644 --- a/examples/diesel-async-postgres/Cargo.toml +++ b/examples/diesel-async-postgres/Cargo.toml @@ -8,9 +8,8 @@ publish = false axum = { path = "../../axum", features = ["macros"] } bb8 = "0.8" diesel = "2" -diesel-async = { version = "0.3", features = ["postgres", "bb8"] } +diesel-async = { version = "0.5", features = ["postgres", "bb8"] } serde = { version = "1.0", features = ["derive"] } -serde_json = "1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/diesel-postgres/Cargo.toml b/examples/diesel-postgres/Cargo.toml index ff42a0db..a68b9df8 100644 --- a/examples/diesel-postgres/Cargo.toml +++ b/examples/diesel-postgres/Cargo.toml @@ -6,11 +6,10 @@ publish = false [dependencies] axum = { path = "../../axum", features = ["macros"] } -deadpool-diesel = { version = "0.4.1", features = ["postgres"] } +deadpool-diesel = { version = "0.6.1", features = ["postgres"] } diesel = { version = "2", features = ["postgres"] } diesel_migrations = "2" serde = { version = "1.0", features = ["derive"] } -serde_json = "1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/error-handling/Cargo.toml b/examples/error-handling/Cargo.toml index 26fc3b98..7aebc903 100644 --- a/examples/error-handling/Cargo.toml +++ b/examples/error-handling/Cargo.toml @@ -8,6 +8,6 @@ publish = false axum = { path = "../../axum", features = ["macros"] } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } -tower-http = { version = "0.5", features = ["trace"] } +tower-http = { version = "0.6.1", features = ["trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/global-404-handler/Cargo.toml b/examples/global-404-handler/Cargo.toml index 9848d9e8..a453cab5 100644 --- a/examples/global-404-handler/Cargo.toml +++ b/examples/global-404-handler/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] axum = { path = "../../axum" } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/graceful-shutdown/Cargo.toml b/examples/graceful-shutdown/Cargo.toml index 86dfd527..c7a57274 100644 --- a/examples/graceful-shutdown/Cargo.toml +++ b/examples/graceful-shutdown/Cargo.toml @@ -6,10 +6,6 @@ publish = false [dependencies] axum = { path = "../../axum", features = ["tracing"] } -hyper = { version = "1.0", features = [] } -hyper-util = { version = "0.1", features = ["tokio", "server-auto", "http1"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } -tower-http = { version = "0.5", features = ["timeout", "trace"] } -tracing = "0.1" +tower-http = { version = "0.6.1", features = ["timeout", "trace"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/handle-head-request/Cargo.toml b/examples/handle-head-request/Cargo.toml index 83a8a66e..8497b089 100644 --- a/examples/handle-head-request/Cargo.toml +++ b/examples/handle-head-request/Cargo.toml @@ -11,4 +11,4 @@ tokio = { version = "1.0", features = ["full"] } [dev-dependencies] http-body-util = "0.1.0" hyper = { version = "1.0.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } +tower = { version = "0.5.1", features = ["util"] } diff --git a/examples/http-proxy/Cargo.toml b/examples/http-proxy/Cargo.toml index aa607002..8dc2f195 100644 --- a/examples/http-proxy/Cargo.toml +++ b/examples/http-proxy/Cargo.toml @@ -9,6 +9,6 @@ axum = { path = "../../axum" } hyper = { version = "1", features = ["full"] } hyper-util = "0.1.1" tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["make"] } +tower = { version = "0.5.1", features = ["make", "util"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/jwt/Cargo.toml b/examples/jwt/Cargo.toml index b0c76c25..54378fe3 100644 --- a/examples/jwt/Cargo.toml +++ b/examples/jwt/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] axum = { path = "../../axum" } axum-extra = { path = "../../axum-extra", features = ["typed-header"] } -jsonwebtoken = "8.0" +jsonwebtoken = "9.3" once_cell = "1.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/examples/key-value-store/Cargo.toml b/examples/key-value-store/Cargo.toml index c23b28d2..ccd28c25 100644 --- a/examples/key-value-store/Cargo.toml +++ b/examples/key-value-store/Cargo.toml @@ -7,14 +7,13 @@ publish = false [dependencies] axum = { path = "../../axum" } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util", "timeout", "load-shed", "limit"] } -tower-http = { version = "0.5.0", features = [ +tower = { version = "0.5.1", features = ["util", "timeout", "load-shed", "limit"] } +tower-http = { version = "0.6.1", features = [ "add-extension", "auth", "compression-full", "limit", "trace", ] } -tower-layer = "0.3.2" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/listen-multiple-addrs/Cargo.toml b/examples/listen-multiple-addrs/Cargo.toml index 8940b943..ed146ca5 100644 --- a/examples/listen-multiple-addrs/Cargo.toml +++ b/examples/listen-multiple-addrs/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "listen-multiple-addrs" +name = "example-listen-multiple-addrs" version = "0.1.0" edition = "2021" publish = false @@ -9,4 +9,4 @@ axum = { path = "../../axum" } hyper = { version = "1.0.0", features = ["full"] } hyper-util = { version = "0.1", features = ["tokio", "server-auto", "http1"] } tokio = { version = "1", features = ["full"] } -tower = { version = "0.4", features = ["util"] } +tower = { version = "0.5.1", features = ["util"] } diff --git a/examples/low-level-openssl/Cargo.toml b/examples/low-level-openssl/Cargo.toml index c5247dec..a74a950e 100644 --- a/examples/low-level-openssl/Cargo.toml +++ b/examples/low-level-openssl/Cargo.toml @@ -12,6 +12,6 @@ hyper-util = { version = "0.1" } openssl = "0.10" tokio = { version = "1", features = ["full"] } tokio-openssl = "0.6" -tower = { version = "0.4", features = ["make"] } +tower = { version = "0.5.1", features = ["make"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/low-level-rustls/Cargo.toml b/examples/low-level-rustls/Cargo.toml index 3975fcb9..1eaf04b3 100644 --- a/examples/low-level-rustls/Cargo.toml +++ b/examples/low-level-rustls/Cargo.toml @@ -12,7 +12,6 @@ hyper-util = { version = "0.1" } rustls-pemfile = "1.0.4" tokio = { version = "1", features = ["full"] } tokio-rustls = "0.24.1" -tower = { version = "0.4", features = ["make"] } tower-service = "0.3.2" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/multipart-form/Cargo.toml b/examples/multipart-form/Cargo.toml index d93b9c08..143154e8 100644 --- a/examples/multipart-form/Cargo.toml +++ b/examples/multipart-form/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum", features = ["multipart"] } tokio = { version = "1.0", features = ["full"] } -tower-http = { version = "0.5.0", features = ["limit", "trace"] } +tower-http = { version = "0.6.1", features = ["limit", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/print-request-response/Cargo.toml b/examples/print-request-response/Cargo.toml index a314b5b7..d6e064bb 100644 --- a/examples/print-request-response/Cargo.toml +++ b/examples/print-request-response/Cargo.toml @@ -7,8 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum" } http-body-util = "0.1.0" -hyper = { version = "1.0.0", features = ["full"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util", "filter"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/prometheus-metrics/Cargo.toml b/examples/prometheus-metrics/Cargo.toml index a30e4436..56ccdd05 100644 --- a/examples/prometheus-metrics/Cargo.toml +++ b/examples/prometheus-metrics/Cargo.toml @@ -6,8 +6,8 @@ publish = false [dependencies] axum = { path = "../../axum" } -metrics = { version = "0.22", default-features = false } -metrics-exporter-prometheus = { version = "0.13", default-features = false } +metrics = { version = "0.23", default-features = false } +metrics-exporter-prometheus = { version = "0.15", default-features = false } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/query-params-with-empty-strings/Cargo.toml b/examples/query-params-with-empty-strings/Cargo.toml index 7a52e98d..6dde9a3a 100644 --- a/examples/query-params-with-empty-strings/Cargo.toml +++ b/examples/query-params-with-empty-strings/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum" } http-body-util = "0.1.0" -hyper = "1.0.0" serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } +tower = { version = "0.5.1", features = ["util"] } diff --git a/examples/readme/Cargo.toml b/examples/readme/Cargo.toml index 4a79c9bb..17669567 100644 --- a/examples/readme/Cargo.toml +++ b/examples/readme/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum" } serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.68" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/request-id/Cargo.toml b/examples/request-id/Cargo.toml new file mode 100644 index 00000000..22879e08 --- /dev/null +++ b/examples/request-id/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "example-request-id" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +axum = { path = "../../axum" } +tokio = { version = "1.0", features = ["full"] } +tower = "0.5" +tower-http = { version = "0.5", features = ["request-id", "trace"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/request-id/src/main.rs b/examples/request-id/src/main.rs new file mode 100644 index 00000000..552d8d4a --- /dev/null +++ b/examples/request-id/src/main.rs @@ -0,0 +1,81 @@ +//! Run with +//! +//! ```not_rust +//! cargo run -p example-request-id +//! ``` + +use axum::{ + http::{HeaderName, Request}, + response::Html, + routing::get, + Router, +}; +use tower::ServiceBuilder; +use tower_http::{ + request_id::{MakeRequestUuid, PropagateRequestIdLayer, SetRequestIdLayer}, + trace::TraceLayer, +}; +use tracing::{error, info, info_span}; +use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; + +const REQUEST_ID_HEADER: &str = "x-request-id"; + +#[tokio::main] +async fn main() { + tracing_subscriber::registry() + .with( + tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| { + // axum logs rejections from built-in extractors with the `axum::rejection` + // target, at `TRACE` level. `axum::rejection=trace` enables showing those events + format!( + "{}=debug,tower_http=debug,axum::rejection=trace", + env!("CARGO_CRATE_NAME") + ) + .into() + }), + ) + .with(tracing_subscriber::fmt::layer()) + .init(); + + let x_request_id = HeaderName::from_static(REQUEST_ID_HEADER); + + let middleware = ServiceBuilder::new() + .layer(SetRequestIdLayer::new( + x_request_id.clone(), + MakeRequestUuid, + )) + .layer( + TraceLayer::new_for_http().make_span_with(|request: &Request<_>| { + // Log the request id as generated. + let request_id = request.headers().get(REQUEST_ID_HEADER); + + match request_id { + Some(request_id) => info_span!( + "http_request", + request_id = ?request_id, + ), + None => { + error!("could not extract request_id"); + info_span!("http_request") + } + } + }), + ) + // send headers from request to response headers + .layer(PropagateRequestIdLayer::new(x_request_id)); + + // build our application with a route + let app = Router::new().route("/", get(handler)).layer(middleware); + + // run it + let listener = tokio::net::TcpListener::bind("127.0.0.1:3000") + .await + .unwrap(); + println!("listening on {}", listener.local_addr().unwrap()); + axum::serve(listener, app).await.unwrap(); +} + +async fn handler() -> Html<&'static str> { + info!("Hello world!"); + Html("

Hello, World!

") +} diff --git a/examples/reqwest-response/Cargo.toml b/examples/reqwest-response/Cargo.toml index cfb91bdc..3ea740e3 100644 --- a/examples/reqwest-response/Cargo.toml +++ b/examples/reqwest-response/Cargo.toml @@ -9,6 +9,6 @@ axum = { path = "../../axum" } reqwest = { version = "0.12", features = ["stream"] } tokio = { version = "1.0", features = ["full"] } tokio-stream = "0.1" -tower-http = { version = "0.5.0", features = ["trace"] } +tower-http = { version = "0.6.1", features = ["trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/rest-grpc-multiplex/Cargo.toml b/examples/rest-grpc-multiplex/Cargo.toml index 11a6a3a2..69ece363 100644 --- a/examples/rest-grpc-multiplex/Cargo.toml +++ b/examples/rest-grpc-multiplex/Cargo.toml @@ -8,13 +8,13 @@ publish = false axum = { path = "../../axum" } futures = "0.3" hyper = { version = "1.0.0", features = ["full"] } -prost = "0.11" -tokio = { version = "1", features = ["full"] } -tonic = { version = "0.9" } -tonic-reflection = "0.9" -tower = { version = "0.4", features = ["full"] } -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } +#prost = "0.11" +#tokio = { version = "1", features = ["full"] } +#tonic = { version = "0.9" } +#tonic-reflection = "0.9" +tower = { version = "0.5.1", features = ["full"] } +#tracing = "0.1" +#tracing-subscriber = { version = "0.3", features = ["env-filter"] } [build-dependencies] tonic-build = { version = "0.9", features = ["prost"] } diff --git a/examples/serve-with-hyper/Cargo.toml b/examples/serve-with-hyper/Cargo.toml index 06f46070..81553eb0 100644 --- a/examples/serve-with-hyper/Cargo.toml +++ b/examples/serve-with-hyper/Cargo.toml @@ -9,4 +9,4 @@ axum = { path = "../../axum" } hyper = { version = "1.0", features = [] } hyper-util = { version = "0.1", features = ["tokio", "server-auto", "http1"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } +tower = { version = "0.5.1", features = ["util"] } diff --git a/examples/simple-router-wasm/Cargo.toml b/examples/simple-router-wasm/Cargo.toml index c3041e4a..d250cc23 100644 --- a/examples/simple-router-wasm/Cargo.toml +++ b/examples/simple-router-wasm/Cargo.toml @@ -14,3 +14,6 @@ axum-extra = { path = "../../axum-extra", default-features = false } futures-executor = "0.3.21" http = "1.0.0" tower-service = "0.3.1" + +[package.metadata.cargo-machete] +ignored = ["axum-extra"] diff --git a/examples/sqlx-postgres/Cargo.toml b/examples/sqlx-postgres/Cargo.toml index 3bc40302..0a0c4376 100644 --- a/examples/sqlx-postgres/Cargo.toml +++ b/examples/sqlx-postgres/Cargo.toml @@ -10,4 +10,4 @@ tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "any", "postgres"] } +sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "any", "postgres"] } diff --git a/examples/sse/Cargo.toml b/examples/sse/Cargo.toml index b2b33159..138820db 100644 --- a/examples/sse/Cargo.toml +++ b/examples/sse/Cargo.toml @@ -11,11 +11,11 @@ futures = "0.3" headers = "0.4" tokio = { version = "1.0", features = ["full"] } tokio-stream = "0.1" -tower-http = { version = "0.5.0", features = ["fs", "trace"] } +tower-http = { version = "0.6.1", features = ["fs", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } [dev-dependencies] eventsource-stream = "0.2" reqwest = { version = "0.12", features = ["stream"] } -reqwest-eventsource = "0.5" +reqwest-eventsource = "0.6" diff --git a/examples/static-file-server/Cargo.toml b/examples/static-file-server/Cargo.toml index 3f41d608..ce195543 100644 --- a/examples/static-file-server/Cargo.toml +++ b/examples/static-file-server/Cargo.toml @@ -6,9 +6,8 @@ publish = false [dependencies] axum = { path = "../../axum" } -axum-extra = { path = "../../axum-extra" } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } -tower-http = { version = "0.5.0", features = ["fs", "trace"] } +tower = { version = "0.5.1", features = ["util"] } +tower-http = { version = "0.6.1", features = ["fs", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/templates-minijinja/Cargo.toml b/examples/templates-minijinja/Cargo.toml index 9b525a8c..692ea0ca 100644 --- a/examples/templates-minijinja/Cargo.toml +++ b/examples/templates-minijinja/Cargo.toml @@ -6,5 +6,5 @@ publish = false [dependencies] axum = { path = "../../axum" } -minijinja = "1.0.11" +minijinja = "2.3.1" tokio = { version = "1.0", features = ["full"] } diff --git a/examples/templates/Cargo.toml b/examples/templates/Cargo.toml index 2f5aba27..6cba0946 100644 --- a/examples/templates/Cargo.toml +++ b/examples/templates/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -askama = "0.11" +askama = "0.12" axum = { path = "../../axum" } tokio = { version = "1.0", features = ["full"] } tracing = "0.1" diff --git a/examples/testing-websockets/Cargo.toml b/examples/testing-websockets/Cargo.toml index afe7b184..31ed2601 100644 --- a/examples/testing-websockets/Cargo.toml +++ b/examples/testing-websockets/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] axum = { path = "../../axum", features = ["ws"] } futures = "0.3" -hyper = { version = "1.0.0", features = ["full"] } tokio = { version = "1.0", features = ["full"] } -tokio-tungstenite = "0.23" +tokio-tungstenite = "0.24" diff --git a/examples/testing/Cargo.toml b/examples/testing/Cargo.toml index 00e8132f..811e4f60 100644 --- a/examples/testing/Cargo.toml +++ b/examples/testing/Cargo.toml @@ -7,14 +7,13 @@ publish = false [dependencies] axum = { path = "../../axum" } http-body-util = "0.1.0" -hyper = { version = "1.0.0", features = ["full"] } hyper-util = { version = "0.1", features = ["client", "http1", "client-legacy"] } mime = "0.3" serde_json = "1.0" tokio = { version = "1.0", features = ["full"] } -tower-http = { version = "0.5.0", features = ["trace"] } +tower-http = { version = "0.6.1", features = ["trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } [dev-dependencies] -tower = { version = "0.4", features = ["util"] } +tower = { version = "0.5.1", features = ["util"] } diff --git a/examples/tls-graceful-shutdown/Cargo.toml b/examples/tls-graceful-shutdown/Cargo.toml index 40e48903..15b3b73b 100644 --- a/examples/tls-graceful-shutdown/Cargo.toml +++ b/examples/tls-graceful-shutdown/Cargo.toml @@ -6,8 +6,7 @@ publish = false [dependencies] axum = { path = "../../axum" } -axum-server = { version = "0.6", features = ["tls-rustls"] } -hyper = { version = "0.14", features = ["full"] } +axum-server = { version = "0.7", features = ["tls-rustls"] } tokio = { version = "1", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/tls-rustls/Cargo.toml b/examples/tls-rustls/Cargo.toml index 4c255c27..9b976f16 100644 --- a/examples/tls-rustls/Cargo.toml +++ b/examples/tls-rustls/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] axum = { path = "../../axum" } -axum-server = { version = "0.6", features = ["tls-rustls"] } +axum-server = { version = "0.7", features = ["tls-rustls"] } tokio = { version = "1", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml index dbd8b712..127fbee4 100644 --- a/examples/todos/Cargo.toml +++ b/examples/todos/Cargo.toml @@ -8,8 +8,8 @@ publish = false axum = { path = "../../axum" } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util", "timeout"] } -tower-http = { version = "0.5.0", features = ["add-extension", "trace"] } +tower = { version = "0.5.1", features = ["util", "timeout"] } +tower-http = { version = "0.6.1", features = ["add-extension", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } uuid = { version = "1.0", features = ["serde", "v4"] } diff --git a/examples/tokio-postgres/Cargo.toml b/examples/tokio-postgres/Cargo.toml index 74806044..e14520d2 100644 --- a/examples/tokio-postgres/Cargo.toml +++ b/examples/tokio-postgres/Cargo.toml @@ -6,8 +6,8 @@ publish = false [dependencies] axum = { path = "../../axum" } -bb8 = "0.7.1" -bb8-postgres = "0.7.0" +bb8 = "0.8.5" +bb8-postgres = "0.8.1" tokio = { version = "1.0", features = ["full"] } tokio-postgres = "0.7.2" tracing = "0.1" diff --git a/examples/tokio-redis/Cargo.toml b/examples/tokio-redis/Cargo.toml index fb276849..86d8513b 100644 --- a/examples/tokio-redis/Cargo.toml +++ b/examples/tokio-redis/Cargo.toml @@ -6,9 +6,9 @@ publish = false [dependencies] axum = { path = "../../axum" } -bb8 = "0.7.1" -bb8-redis = "0.14.0" -redis = "0.24.0" +bb8 = "0.8.5" +bb8-redis = "0.17.0" +redis = "0.27.2" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/tracing-aka-logging/Cargo.toml b/examples/tracing-aka-logging/Cargo.toml index 4004cd59..3d120472 100644 --- a/examples/tracing-aka-logging/Cargo.toml +++ b/examples/tracing-aka-logging/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies] axum = { path = "../../axum", features = ["tracing"] } tokio = { version = "1.0", features = ["full"] } -tower-http = { version = "0.5.0", features = ["trace"] } +tower-http = { version = "0.6.1", features = ["trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/unix-domain-socket/Cargo.toml b/examples/unix-domain-socket/Cargo.toml index 7f157c7d..94ceb040 100644 --- a/examples/unix-domain-socket/Cargo.toml +++ b/examples/unix-domain-socket/Cargo.toml @@ -10,6 +10,5 @@ http-body-util = "0.1" hyper = { version = "1.0.0", features = ["full"] } hyper-util = { version = "0.1", features = ["tokio", "server-auto", "http1"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = ["util"] } -tracing = "0.1" +tower = { version = "0.5.1", features = ["util"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/validator/Cargo.toml b/examples/validator/Cargo.toml index 98d00cec..8a7e6928 100644 --- a/examples/validator/Cargo.toml +++ b/examples/validator/Cargo.toml @@ -6,10 +6,9 @@ version = "0.1.0" [dependencies] axum = { path = "../../axum" } -http-body = "1.0.0" serde = { version = "1.0", features = ["derive"] } thiserror = "1.0.29" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -validator = { version = "0.14.0", features = ["derive"] } +validator = { version = "0.18.1", features = ["derive"] } diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 842a09a3..541d8280 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -11,9 +11,8 @@ futures = "0.3" futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] } headers = "0.4" tokio = { version = "1.0", features = ["full"] } -tokio-tungstenite = "0.23" -tower = { version = "0.4", features = ["util"] } -tower-http = { version = "0.5.0", features = ["fs", "trace"] } +tokio-tungstenite = "0.24.0" +tower-http = { version = "0.6.1", features = ["fs", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] }