mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Expect 204 status when using hipchat v2 api.
When posting to the room notication api with hipchat v2 api, the expected return code is 204, as per: https://www.hipchat.com/docs/apiv2/method/send_room_notification fixes #2143
This commit is contained in:
parent
67967d04ee
commit
a66a0187d1
1 changed files with 4 additions and 1 deletions
|
@ -149,7 +149,10 @@ def send_msg_v2(module, token, room, msg_from, msg, msg_format='text',
|
|||
module.exit_json(changed=False)
|
||||
|
||||
response, info = fetch_url(module, url, data=data, headers=headers, method='POST')
|
||||
if info['status'] == 200:
|
||||
|
||||
# https://www.hipchat.com/docs/apiv2/method/send_room_notification shows
|
||||
# 204 to be the expected result code.
|
||||
if info['status'] in [200, 204]:
|
||||
return response.read()
|
||||
else:
|
||||
module.fail_json(msg="failed to send message, return status=%s" % str(info['status']))
|
||||
|
|
Loading…
Reference in a new issue