Skip to content

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

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