Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 699a1c9

Browse files
committed
auth: allow auth backends prepare_request() to be a coroutine function
Signed-off-by: Florian Scherf <f.scherf@pengutronix.de>
1 parent 1cd1944 commit 699a1c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aiohttp_json_rpc/rpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ def __call__(self, request):
253253
async def handle_request(self, request):
254254
# prepare request
255255
request.rpc = self
256-
self.auth_backend.prepare_request(request)
256+
coroutine = self.auth_backend.prepare_request(request)
257+
258+
if asyncio.iscoroutine(coroutine):
259+
await coroutine
257260

258261
# handle request
259262
if request.method == 'GET':

0 commit comments

Comments
 (0)