From a67ff131f63b27e5745b581a9d3481d20f6c1480 Mon Sep 17 00:00:00 2001 From: edpyt Date: Thu, 9 May 2024 15:02:17 +0300 Subject: [PATCH] add async resolve --- blacksheep/server/bindings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blacksheep/server/bindings.py b/blacksheep/server/bindings.py index 7442939..56113ff 100644 --- a/blacksheep/server/bindings.py +++ b/blacksheep/server/bindings.py @@ -29,6 +29,7 @@ ) from urllib.parse import unquote from uuid import UUID +import inspect from dateutil.parser import parse as dateutil_parser from guardpost import Identity @@ -811,7 +812,10 @@ async def get_value(self, request: Request) -> Any: scope = None assert self.services is not None try: - return self.services.resolve(self.expected_type, scope) + if inspect.iscoroutinefunction(self.services.resolve): + return await self.services.resolve(self.expected_type, scope) + else: + return self.services.resolve(self.expected_type, scope) except CannotResolveTypeException: return None