From a985d8c1340f80ab69b2b0e5de799df98d567732 Mon Sep 17 00:00:00 2001 From: Kevin Lutzer Date: Tue, 10 Sep 2024 02:44:30 -0400 Subject: [PATCH] Remove Redirect Causing Invalid URIs for Swagger UIs Server on / (#1043) * Remove a redirect that causes routing to invalid URIs for a Swagger UI served on / * remove slash path --- utoipa-swagger-ui/src/axum.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/utoipa-swagger-ui/src/axum.rs b/utoipa-swagger-ui/src/axum.rs index 5315fc3f..22a31793 100644 --- a/utoipa-swagger-ui/src/axum.rs +++ b/utoipa-swagger-ui/src/axum.rs @@ -44,13 +44,9 @@ where let handler = routing::get(serve_swagger_ui).layer(Extension(Arc::new(config))); let path: &str = swagger_ui.path.as_ref(); - let slash_path = format!("{}/", path); router - .route( - path, - routing::get(|| async move { axum::response::Redirect::to(&slash_path) }), - ) + .route(path, handler.clone()) .route(&format!("{}/", path), handler.clone()) .route(&format!("{}/*rest", path), handler) }