Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

logging_util: Save an assertion with __getitem__.

Zixuan James Li417e1b5e81e5
diff --git a/zerver/lib/logging_util.py b/zerver/lib/logging_util.py
index f9769cf312b..09c3593236f 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: