mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-18 23:23:30 +01:00
Make it more obvious that NEST_TAIL_PARAM
is reserved (#836)
This commit is contained in:
parent
a438e6b106
commit
b05a5c6dfe
2 changed files with 10 additions and 4 deletions
|
@ -99,8 +99,8 @@ impl<B> fmt::Debug for Router<B> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) const NEST_TAIL_PARAM: &str = "axum_nest";
|
pub(crate) const NEST_TAIL_PARAM: &str = "__private__axum_nest_tail_param";
|
||||||
const NEST_TAIL_PARAM_CAPTURE: &str = "/*axum_nest";
|
const NEST_TAIL_PARAM_CAPTURE: &str = "/*__private__axum_nest_tail_param";
|
||||||
|
|
||||||
impl<B> Router<B>
|
impl<B> Router<B>
|
||||||
where
|
where
|
||||||
|
|
|
@ -525,7 +525,10 @@ async fn route_layer() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[should_panic(
|
#[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() {
|
async fn good_error_message_if_using_nest_root() {
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
|
@ -536,7 +539,10 @@ async fn good_error_message_if_using_nest_root() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[should_panic(
|
#[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() {
|
async fn good_error_message_if_using_nest_root_when_merging() {
|
||||||
let one = Router::new().nest("/", get(|| async {}));
|
let one = Router::new().nest("/", get(|| async {}));
|
||||||
|
|
Loading…
Reference in a new issue