Skip to main content

fallback_405

Function fallback_405 

Source
pub async fn fallback_405() -> Response
Expand description

Handler for method-not-allowed responses.

Returns a 405 JSON response: {"error": "method not allowed", "status": 405}.

Prefer axum::Router::method_not_allowed_fallback for router-wide 405s:

use aro_web::fallback::fallback_405;
use axum::Router;
use axum::routing::get;

let _app: Router = Router::new()
    .route("/users", get(|| async { "ok" }))
    .method_not_allowed_fallback(fallback_405);