Skip to content

Commit

Permalink
Use json loads/dumps to prevent encoding aleas
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jun 17, 2021
1 parent 386ec00 commit 92beeb8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion isso/ext/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,15 @@ def send(self, structured_msg: str) -> bool:
:rtype: bool
"""
# load the message to ensure encoding
msg_json = json.loads(structured_msg)

with Session() as requests_session:

# send requests
response = requests_session.post(
url=self.wh_url,
data=structured_msg,
json=json.dumps(msg_json),
headers={
"Content-Type": "application/json",
"User-Agent": "Isso/{0} (+https://posativ.org/isso)".format(
Expand Down

0 comments on commit 92beeb8

Please sign in to comment.