I'm encountering an issue when Klaviyo returns a 400 (Bad Request) but does not provide any response body. The change from issue #40 assumes that the response contains some details and tries to provide them, but since the response is empty, it causes a PHP notice since it's looking for a "detail" element that doesn't exist:
Notice: Undefined index: detail in Klaviyo\KlaviyoAPI->handleResponse() (line 185 of /var/www/www.highlights.com/webroot/sites/www.highlights.com/modules/hfc_comm_pref/vendor/klaviyo/php-sdk/src/KlaviyoAPI.php).
This happens, for instance, when I attempt to check whether a profile belongs to a list, but the list ID I passed is invalid. Of course the obvious response in this case might be "so don't pass invalid list IDs", but given that there exists any situation where Klaviyo might choose to reply with an empty 400 response, it would be nice if handleResponse was prepared for that situation and didn't clutter the logs with PHP notices.
I'm encountering an issue when Klaviyo returns a 400 (Bad Request) but does not provide any response body. The change from issue #40 assumes that the response contains some details and tries to provide them, but since the response is empty, it causes a PHP notice since it's looking for a "detail" element that doesn't exist:
Notice: Undefined index: detail in Klaviyo\KlaviyoAPI->handleResponse() (line 185 of /var/www/www.highlights.com/webroot/sites/www.highlights.com/modules/hfc_comm_pref/vendor/klaviyo/php-sdk/src/KlaviyoAPI.php).
This happens, for instance, when I attempt to check whether a profile belongs to a list, but the list ID I passed is invalid. Of course the obvious response in this case might be "so don't pass invalid list IDs", but given that there exists any situation where Klaviyo might choose to reply with an empty 400 response, it would be nice if handleResponse was prepared for that situation and didn't clutter the logs with PHP notices.