Skip to content

Commit

Permalink
added encode option (robusta-dev#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
swastik959 authored and pavangudiwada committed Nov 6, 2023
1 parent 829aa33 commit c28bc93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/robusta/core/sinks/webhook/webhook_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit c28bc93

Please sign in to comment.