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:
David Pedersen
2021-10-24 20:52:42 +02:00
committed by GitHub
parent 1a764bb8d7
commit 0ee7379d4f
13 changed files with 203 additions and 242 deletions
+1 -3
View File
@@ -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 {