diff --git a/axum/src/routing/tests/fallback.rs b/axum/src/routing/tests/fallback.rs index bf42d8b51c..1b483eadda 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_state_not_used() { + 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"); +} \ No newline at end of file