Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 5, 2024
1 parent 227ac01 commit c68d42a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions monailabel/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi.responses import FileResponse, HTMLResponse
from fastapi.staticfiles import StaticFiles
from starlette.middleware.base import BaseHTTPMiddleware

from monailabel.config import settings
from monailabel.endpoints import (
Expand All @@ -37,16 +38,17 @@
wsi_infer,
)
from monailabel.interfaces.utils.app import app_instance, clear_cache
from starlette.middleware.base import BaseHTTPMiddleware


class TrailingSlashMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
path = str(request.url.path)
new_path = f"/{path}" if not path.startswith('//') else path
request.scope['path'] = new_path
new_path = f"/{path}" if not path.startswith("//") else path
request.scope["path"] = new_path
response = await call_next(request)
return response


origins = [str(origin) for origin in settings.MONAI_LABEL_CORS_ORIGINS] if settings.MONAI_LABEL_CORS_ORIGINS else ["*"]
print(f"Allow Origins: {origins}")

Expand Down

0 comments on commit c68d42a

Please sign in to comment.