From 36854ca3d726762c8826941599eaba1e666985a5 Mon Sep 17 00:00:00 2001 From: Philipp Schneider Date: Fri, 13 May 2022 21:40:02 +0200 Subject: [PATCH] Use application/json in request headers --- library/Phue/Transport/Adapter/Curl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Phue/Transport/Adapter/Curl.php b/library/Phue/Transport/Adapter/Curl.php index a209f83..2878635 100644 --- a/library/Phue/Transport/Adapter/Curl.php +++ b/library/Phue/Transport/Adapter/Curl.php @@ -60,7 +60,8 @@ public function send($address, $method, $body = null) curl_setopt($this->curl, CURLOPT_HEADER, false); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); - if (strlen($body)) { + if (isset($body) && strlen($body)) { + curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json')); curl_setopt($this->curl, CURLOPT_POSTFIELDS, $body); }