summary refs log tree commit diff
path: root/synapse/http/additional_resource.py
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2021-12-15 22:38:29 -0600
committerEric Eastwood <erice@element.io>2021-12-15 22:38:29 -0600
commit1d0004312a3c77869808d7bd30b21c4e5c1572a8 (patch)
tree62ebebe9f7809bc0358447268debeed3127587ad /synapse/http/additional_resource.py
parentMerge branch 'develop' into madlittlemods/return-historical-events-in-order-f... (diff)
parentAdd type hints to `synapse/storage/databases/main/room.py` (#11575) (diff)
downloadsynapse-1d0004312a3c77869808d7bd30b21c4e5c1572a8.tar.xz
Merge branch 'develop' into madlittlemods/return-historical-events-in-order-from-backfill
Conflicts:
	synapse/handlers/message.py
	synapse/handlers/room_member.py
Diffstat (limited to 'synapse/http/additional_resource.py')
-rw-r--r--synapse/http/additional_resource.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/http/additional_resource.py b/synapse/http/additional_resource.py

index 9a2684aca4..6a9f6635d2 100644 --- a/synapse/http/additional_resource.py +++ b/synapse/http/additional_resource.py
@@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, Tuple from twisted.web.server import Request @@ -32,7 +32,11 @@ class AdditionalResource(DirectServeJsonResource): and exception handling. """ - def __init__(self, hs: "HomeServer", handler): + def __init__( + self, + hs: "HomeServer", + handler: Callable[[Request], Awaitable[Optional[Tuple[int, Any]]]], + ): """Initialise AdditionalResource The ``handler`` should return a deferred which completes when it has @@ -47,7 +51,7 @@ class AdditionalResource(DirectServeJsonResource): super().__init__() self._handler = handler - def _async_render(self, request: Request): + async def _async_render(self, request: Request) -> Optional[Tuple[int, Any]]: # Cheekily pass the result straight through, so we don't need to worry # if its an awaitable or not. - return self._handler(request) + return await self._handler(request)