Skip to content

Commit

Permalink
Remove Redirect Causing Invalid URIs for Swagger UIs Server on / (#1043)
Browse files Browse the repository at this point in the history
* Remove a redirect that causes routing to invalid URIs for a Swagger UI served on /

* remove slash path
  • Loading branch information
kevinlutzer authored Sep 10, 2024
1 parent 2d81c9b commit a985d8c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions utoipa-swagger-ui/src/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit a985d8c

Please sign in to comment.