Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

CORTX-32290: Added normalize path middleware #900

Merged
merged 8 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions csm/core/agent/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
from asyncio import CancelledError as AsyncioCancelledError
from weakref import WeakSet
from aiohttp import web, web_exceptions
from aiohttp.client_exceptions import ServerDisconnectedError, ClientConnectorError, ClientOSError
from aiohttp.client_exceptions import (ServerDisconnectedError,
ClientConnectorError, ClientOSError)
from aiohttp.web_middlewares import normalize_path_middleware
from abc import ABC
from secure import SecureHeaders
from typing import Dict, Tuple
Expand Down Expand Up @@ -116,11 +118,14 @@ def init():
Log.info(f"CSM request quota is set to {CsmRestApi.__request_quota}")

CsmRestApi._app = web.Application(
middlewares=[CsmRestApi.throttler_middleware,
middlewares=[normalize_path_middleware(remove_slash=True,
append_slash = False),
CsmRestApi.throttler_middleware,
CsmRestApi.set_secure_headers,
CsmRestApi.rest_middleware,
CsmRestApi.session_middleware,
CsmRestApi.permission_middleware]
CsmRestApi.permission_middleware
]
)

CsmRoutes.add_routes(CsmRestApi._app)
Expand Down
1 change: 0 additions & 1 deletion csm/core/controllers/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ async def post(self):
# TODO: Stop any websocket connection corresponding to this session
Log.info(f"[{self.request.request_id}] Logout successful. User: {username}")
return CsmResponse()

1 change: 0 additions & 1 deletion csm/core/controllers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,3 @@ async def patch(self):
f"[{self.request.request_id}] Processed request: {self.request.method} {self.request.path}"\
f" User: {loggedin_user_id}")
return resp