mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
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.
This commit is contained in:
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…
x
Reference in New Issue
Block a user