Skip to content

Commit

Permalink
add another test for method_not_allowed_fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachstec committed Oct 11, 2024
1 parent 70701cb commit f7580f2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions axum/src/routing/tests/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

0 comments on commit f7580f2

Please sign in to comment.