diff --git a/axum/src/routing/tests/fallback.rs b/axum/src/routing/tests/fallback.rs index bf42d8b51c..9b72365c1b 100644 --- a/axum/src/routing/tests/fallback.rs +++ b/axum/src/routing/tests/fallback.rs @@ -361,3 +361,15 @@ async fn mna_fallback_with_state() { let res = client.post("/").await; assert_eq!(res.text().await, "state"); } + +#[crate::test] +async fn mna_fallback_with_unused_state() { + let app = Router::new() + .route("/", get(|| async { "index" })) + .with_state(()) + .method_not_allowed_fallback(|| async move { "bla" }); + + let client = TestClient::new(app); + let res = client.post("/").await; + assert_eq!(res.text().await, "bla"); +}