From cb90f5d7a8e98cd8ad11cdf596c24ef5320d49df Mon Sep 17 00:00:00 2001 From: Kirill Kuzminykh Date: Mon, 10 Jul 2023 10:10:27 +0300 Subject: [PATCH] Added "sockjs_transport_name" into request object. --- sockjs/route.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sockjs/route.py b/sockjs/route.py index 9174a0c..12060f9 100644 --- a/sockjs/route.py +++ b/sockjs/route.py @@ -7,6 +7,7 @@ from typing import Iterable, List, Optional, Type from aiohttp import hdrs, web +from aiohttp.web_request import Request try: @@ -189,7 +190,7 @@ def __init__( transport_names - self.disable_transports ) - async def handler(self, request): + async def handler(self, request: Request): info = request.match_info # lookup transport @@ -212,6 +213,7 @@ async def handler(self, request): except KeyError: raise web.HTTPNotFound(headers=session_cookie(request)) + request["sockjs_transport_name"] = transport_class.name transport = transport_class(manager, session, request) try: return await transport.process()