Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow serving swagger-ui as index #1852

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

karisN
Copy link

@karisN karisN commented Jan 17, 2024

Allow serving swagger-ui as index

Propose fix for #1851

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @karisN!

Pre-commit is failing. You can install it locally using:

pip install poetry
poetry install --all-extras
pre-commit install

@@ -151,12 +151,12 @@ async def redirect(request):
url += "/"
return RedirectResponse(url=url)

self.router.add_route(methods=["GET"], path=console_ui_path, endpoint=redirect)
self.router.add_route(methods=["GET"], path=console_ui_path or "/", endpoint=redirect)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather change the way the path is stripped above.

console_ui_path = self.options.swagger_ui_path.strip().rstrip("/") + "/"

and removing the leading "/" from the suffixes we add everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants