logging_util: Save an assertion with __getitem__.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li 2022-06-24 11:02:44 -04:00 committed by Tim Abbott
parent fc3de0ba41
commit 417e1b5e81
1 changed files with 2 additions and 3 deletions

View File

@ -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: