From 14ab8bd346a340b784335fd8163b358401a5ad94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Ma=C3=AFzi?= Date: Thu, 30 Jul 2020 11:11:40 +0200 Subject: [PATCH] [routes] Await route function in decorator. --- halfapi/lib/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index ade0409..bd6de54 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -35,11 +35,11 @@ def get_routes(domains=None): def route_decorator(fct, acls_mod, acls): @wraps(fct) - def caller(req: Request, *args, **kwargs): + async def caller(req: Request, *args, **kwargs): for acl_fct_name in acls: acl_fct = getattr(acls_mod, acl_fct_name) if acl_fct(req, *args, **kwargs): - return fct(req, *args, **kwargs) + return await fct(req, *args, **kwargs) raise HTTPException(401)