redash icon indicating copy to clipboard operation
redash copied to clipboard

Support utf-8 for webhook

Open jingyugao opened this issue 5 months ago • 0 comments

Issue Summary

When webhook message contains utf-8 chars, the requests.post will cause a traceback.

Steps to Reproduce

  1. Send an webhook alert contains utf-8 chars.
  2. This line code will cause a traceback. https://github.com/getredash/redash/blob/6b1e91012654cda91a4fb64075197b8b3be2cd44/redash/destinations/webhook.py#L45

Technical details:

  • Redash Version:latest
  • Browser/OS: linux
  • How did you install Redash: docker image

example code for test

import requests

try:
    resp = requests.post(
        "https://example.com",
        data="你好",
        headers={},
        timeout=5.0,
    )
except Exception as e:
    print(e)

resp = requests.post(
    "https://example.com",
    data="你好".encode("utf-8"),
    headers={},
    timeout=5.0,
)
print(resp.status_code)

jingyugao avatar Jun 27 '25 12:06 jingyugao