From 68b458b067a4c7c928eebe95b73fde702192fed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20GATELLIER?= <26511053+lgatellier@users.noreply.github.com> Date: Wed, 8 May 2024 13:54:16 +0200 Subject: [PATCH] refactor(api): rename WebHookRequest.init() to await_body() --- hookbridge/api.py | 2 +- hookbridge/request.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hookbridge/api.py b/hookbridge/api.py index 2d2fe7d..eb05d89 100644 --- a/hookbridge/api.py +++ b/hookbridge/api.py @@ -19,7 +19,7 @@ async def dispatch( routes: RouteService = Depends(Provide[WebhookGatewayConfig.routes_service]), ): wrapper_req = WebhookRequest(req) - await wrapper_req.init() # Awaits request body + await wrapper_req.await_body() # Awaits request body call_results = routes.dispatch(route_name, wrapper_req) return {"route": route_name, "called_rules": [r.__dict__ for r in call_results]} diff --git a/hookbridge/request.py b/hookbridge/request.py index d812fca..0b78d5f 100644 --- a/hookbridge/request.py +++ b/hookbridge/request.py @@ -31,5 +31,5 @@ def body(self) -> bytes: def context(self) -> ExecutionContext: return self.__context - async def init(self): + async def await_body(self): self.__body = json.loads(await self.__req.body())