From b05a5c6dfe09f2bca56f8c2bdb4a631104d064b3 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 6 Mar 2022 17:01:14 +0100 Subject: [PATCH] Make it more obvious that `NEST_TAIL_PARAM` is reserved (#836) --- axum/src/routing/mod.rs | 4 ++-- axum/src/routing/tests/mod.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/axum/src/routing/mod.rs b/axum/src/routing/mod.rs index be96a644..d80a3fd1 100644 --- a/axum/src/routing/mod.rs +++ b/axum/src/routing/mod.rs @@ -99,8 +99,8 @@ impl fmt::Debug for Router { } } -pub(crate) const NEST_TAIL_PARAM: &str = "axum_nest"; -const NEST_TAIL_PARAM_CAPTURE: &str = "/*axum_nest"; +pub(crate) const NEST_TAIL_PARAM: &str = "__private__axum_nest_tail_param"; +const NEST_TAIL_PARAM_CAPTURE: &str = "/*__private__axum_nest_tail_param"; impl Router where diff --git a/axum/src/routing/tests/mod.rs b/axum/src/routing/tests/mod.rs index 4dce4073..4052c653 100644 --- a/axum/src/routing/tests/mod.rs +++ b/axum/src/routing/tests/mod.rs @@ -525,7 +525,10 @@ async fn route_layer() { #[tokio::test] #[should_panic( - expected = "Invalid route: insertion failed due to conflict with previously registered route: /*axum_nest. Note that `nest(\"/\", _)` conflicts with all routes. Use `Router::fallback` instead" + expected = "Invalid route: insertion failed due to conflict with previously registered \ + route: /*__private__axum_nest_tail_param. \ + Note that `nest(\"/\", _)` conflicts with all routes. \ + Use `Router::fallback` instead" )] async fn good_error_message_if_using_nest_root() { let app = Router::new() @@ -536,7 +539,10 @@ async fn good_error_message_if_using_nest_root() { #[tokio::test] #[should_panic( - expected = "Invalid route: insertion failed due to conflict with previously registered route: /*axum_nest. Note that `nest(\"/\", _)` conflicts with all routes. Use `Router::fallback` instead" + expected = "Invalid route: insertion failed due to conflict with previously registered \ + route: /*__private__axum_nest_tail_param. \ + Note that `nest(\"/\", _)` conflicts with all routes. \ + Use `Router::fallback` instead" )] async fn good_error_message_if_using_nest_root_when_merging() { let one = Router::new().nest("/", get(|| async {}));