Skip to content

Commit

Permalink
refactor(api): rename WebHookRequest.init() to await_body()
Browse files Browse the repository at this point in the history
  • Loading branch information
lgatellier committed May 8, 2024
1 parent 3ac3413 commit 68b458b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hookbridge/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}

Expand Down
2 changes: 1 addition & 1 deletion hookbridge/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit 68b458b

Please sign in to comment.