From c28bc93e834e7a07ce3fa190331f8dbf46d74628 Mon Sep 17 00:00:00 2001 From: Swastik Gour <48011880+swastik959@users.noreply.github.com> Date: Mon, 30 Oct 2023 03:19:10 +0530 Subject: [PATCH] added encode option (#1130) --- src/robusta/core/sinks/webhook/webhook_sink.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/robusta/core/sinks/webhook/webhook_sink.py b/src/robusta/core/sinks/webhook/webhook_sink.py index 57b262553..98f96d943 100644 --- a/src/robusta/core/sinks/webhook/webhook_sink.py +++ b/src/robusta/core/sinks/webhook/webhook_sink.py @@ -51,12 +51,12 @@ def write_finding(self, finding: Finding, platform_enabled: bool): {line} """ ) - if len(message) + len(wrapped) >= self.size_limit: + if len(message.encode('utf-8')) + len(wrapped.encode('utf8')) >= self.size_limit: break message += wrapped try: - r = requests.post(self.url, data=message, headers=self.headers) + r = requests.post(self.url, data=message.encode('utf-8'), headers=self.headers) r.raise_for_status() except Exception: logging.exception(f"Webhook request error\n headers: \n{self.headers}")