Force requests to emit application/json

When sending webhook notifications
This commit is contained in:
Matthew Jones 2016-07-25 12:44:41 -04:00
parent 30ed7b487b
commit 60e012f75b

View File

@ -32,7 +32,7 @@ class WebhookBackend(TowerBaseEmailBackend):
self.headers['User-Agent'] = "Tower {}".format(get_awx_version())
for m in messages:
r = requests.post("{}".format(m.recipients()[0]),
data=json.dumps(m.body),
json=m.body,
headers=self.headers)
if r.status_code >= 400:
logger.error(smart_text("Error sending notification webhook: {}".format(r.text)))