From 417e1b5e81e58cb4e8dd3a629b9346fe116ef07a Mon Sep 17 00:00:00 2001 From: Zixuan James Li Date: Fri, 24 Jun 2022 11:02:44 -0400 Subject: [PATCH] logging_util: Save an assertion with __getitem__. Signed-off-by: Zixuan James Li --- zerver/lib/logging_util.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zerver/lib/logging_util.py b/zerver/lib/logging_util.py index f9769cf312..09c3593236 100644 --- a/zerver/lib/logging_util.py +++ b/zerver/lib/logging_util.py @@ -255,11 +255,10 @@ class ZulipWebhookFormatter(ZulipFormatter): return super().format(record) if request.content_type == "application/json": - payload: Union[str, bytes, None] = request.body + payload: Union[str, bytes] = request.body else: - payload = request.POST.get("payload") + payload = request.POST["payload"] - assert payload is not None try: payload = orjson.dumps(orjson.loads(payload), option=orjson.OPT_INDENT_2).decode() except orjson.JSONDecodeError: