mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Fix compile time regression by boxing routes internally (#404)
This is a reimplementation of #401 but with the new matchit based router. Fixes #399
This commit is contained in:
@@ -13,7 +13,6 @@ use axum::{
|
||||
handler::{delete, get, Handler},
|
||||
http::StatusCode,
|
||||
response::IntoResponse,
|
||||
routing::BoxRoute,
|
||||
Router,
|
||||
};
|
||||
use std::{
|
||||
@@ -108,7 +107,7 @@ async fn list_keys(Extension(state): Extension<SharedState>) -> String {
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
fn admin_routes() -> Router<BoxRoute> {
|
||||
fn admin_routes() -> Router {
|
||||
async fn delete_all_keys(Extension(state): Extension<SharedState>) {
|
||||
state.write().unwrap().db.clear();
|
||||
}
|
||||
@@ -122,7 +121,6 @@ fn admin_routes() -> Router<BoxRoute> {
|
||||
.route("/key/:key", delete(remove_key))
|
||||
// Require bearer auth for all admin routes
|
||||
.layer(RequireAuthorizationLayer::bearer("secret-token"))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
fn handle_error(error: BoxError) -> impl IntoResponse {
|
||||
|
||||
Reference in New Issue
Block a user