Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Mattermost alert webhook call (#5700)
Mattermost seems to have gotten more particular about the `Content-Type` header of incoming webhooks in the upgrade from 5.18 to 5.22. We were seeing errors of this kind: ```json { "level": "error", "ts": 1588614108.121396, "caller": "mlog/log.go:175", "msg": "Could not decode the multipart payload of incoming webhook.", "path": "/hooks/<hook_id>", "request_id": "wsb5g1xiqine7knmgj9yo9887w", "ip_addr": "<ip>", "user_id":"", "method": "POST", "err_where": "incomingWebhook", "http_code": 400, "err_details": "mime: no media type" } ``` This change switches our alert webhook's `requests.post` call from using Requests' `data` param to using its `json` param, which sets the `Content-Type` to `application/json`, as Mattermost now requires. See: https://requests.readthedocs.io/en/master/user/quickstart/#more-complicated-post-requests
- Loading branch information