1
0
mirror of https://github.com/etesync/server synced 2024-11-19 07:18:08 +00:00

Type fix.

This commit is contained in:
Tom Hacohen 2024-06-08 18:17:59 -04:00
parent 49eeeefef5
commit 0d9c9f153d

View File

@ -61,12 +61,13 @@ class MsgpackRoute(APIRoute):
def get_route_handler(self) -> t.Callable: def get_route_handler(self) -> t.Callable:
async def custom_route_handler(request: Request) -> Response: async def custom_route_handler(request: Request) -> Response:
content_type = request.headers.get("Content-Type") content_type = request.headers.get("Content-Type")
try: if content_type is not None:
request_cls = self.REQUESTS_CLASSES[content_type] try:
request = request_cls(request.scope, request.receive) request_cls = self.REQUESTS_CLASSES[content_type]
except KeyError: request = request_cls(request.scope, request.receive)
# nothing registered to handle content_type, process given requests as-is except KeyError:
pass # nothing registered to handle content_type, process given requests as-is
pass
accept = request.headers.get("Accept") accept = request.headers.get("Accept")
route_handler = self._get_media_type_route_handler(accept) route_handler = self._get_media_type_route_handler(accept)