From 5a077918b7d0e64cc5308b2f2870d2587aaa4252 Mon Sep 17 00:00:00 2001 From: Moritz Pein Date: Tue, 10 Apr 2018 08:09:04 +0200 Subject: [PATCH 1/2] only set content-type header if there is content --- figo/Connection.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/figo/Connection.php b/figo/Connection.php index 49e04f3..55a4db1 100644 --- a/figo/Connection.php +++ b/figo/Connection.php @@ -107,8 +107,11 @@ public function query_api($path, array $data = null, $method='POST', $encode='ht } $headers = array("Authorization" => "Basic ".base64_encode($this->client_id.":".$this->client_secret), - "Content-Type" => $content_type, "Content-Length" => strlen($data)); + if (strlen($data) > 0) { + $headers["Content-Type"] = $content_type; + + } $request = new HttpsRequest($this->apiUrl['host'], $this->fingerprints, $this->logger); $path = $this->apiUrl['path'] . $path; From 7e48f6c49d59c527a9ad996afaff19468f650e90 Mon Sep 17 00:00:00 2001 From: Moritz Pein Date: Tue, 10 Apr 2018 09:24:11 +0200 Subject: [PATCH 2/2] remove empty line --- figo/Connection.php | 1 - 1 file changed, 1 deletion(-) diff --git a/figo/Connection.php b/figo/Connection.php index 55a4db1..09afaf1 100644 --- a/figo/Connection.php +++ b/figo/Connection.php @@ -110,7 +110,6 @@ public function query_api($path, array $data = null, $method='POST', $encode='ht "Content-Length" => strlen($data)); if (strlen($data) > 0) { $headers["Content-Type"] = $content_type; - } $request = new HttpsRequest($this->apiUrl['host'], $this->fingerprints, $this->logger);