Allow all success status codes in REST notify response (#22011)
For example Discord webhooks returns a 204 success code as response, which gets logged as an error in the log, even though it is successful. Update the allowed statuses to accept all 2xx responses as successful.pull/22014/head
parent
83243e95d3
commit
2dcd9d94c8
|
@ -112,7 +112,8 @@ class RestNotificationService(BaseNotificationService):
|
|||
response = requests.get(self._resource, headers=self._headers,
|
||||
params=data, timeout=10)
|
||||
|
||||
if response.status_code not in (200, 201, 202):
|
||||
success_codes = (200, 201, 202, 203, 204, 205, 206, 207, 208, 226)
|
||||
if response.status_code not in success_codes:
|
||||
_LOGGER.exception(
|
||||
"Error sending message. Response %d: %s:",
|
||||
response.status_code, response.reason)
|
||||
|
|
Loading…
Reference in New Issue