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.

webhooks: Do not predicate on the "payload" key.

Alex Vandiver7001004ec076
diff --git a/zerver/decorator.py b/zerver/decorator.py
index 82dee5e3bca..1623ac13460 100644
--- a/zerver/decorator.py
+++ b/zerver/decorator.py
@@ -553,12 +553,10 @@ def authenticated_rest_api_view(
if webhook_client_name is not None:
if isinstance(err, UnsupportedWebhookEventType):
err.webhook_name = webhook_client_name
- request_body = request.POST.get('payload')
- if request_body is not None:
- log_exception_to_webhook_logger(
- summary=str(err),
- unsupported_event=isinstance(err, UnsupportedWebhookEventType),
- )
+ log_exception_to_webhook_logger(
+ summary=str(err),
+ unsupported_event=isinstance(err, UnsupportedWebhookEventType),
+ )
raise err
return _wrapped_func_arguments
diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.py
index be038c19e3d..c2b0bba6239 100644
--- a/zerver/tests/test_decorators.py
+++ b/zerver/tests/test_decorators.py
@@ -461,7 +461,6 @@ class DecoratorLoggingTestCase(ZulipTestCase):
request.host = "zulip.testserver"
request.body = '{}'
- request.POST['payload'] = '{}'
request.content_type = 'text/plain'
with mock.patch('zerver.decorator.webhook_logger.exception') as mock_exception:
@@ -483,7 +482,6 @@ class DecoratorLoggingTestCase(ZulipTestCase):
request.host = "zulip.testserver"
request.body = '{}'
- request.POST['payload'] = '{}'
request.content_type = 'text/plain'
with mock.patch('zerver.decorator.webhook_unsupported_events_logger.exception') as mock_exception: