Compare commits

...

2 Commits

Author SHA1 Message Date
malle-pietje
021d01ba86 API client class v1.1.68
- fixed a bug that was introduced with 1.1.67 and would only occur in certain corner cases
2021-01-24 18:09:38 +01:00
malle-pietje
caf838abb9 API client class v1.1.67
- fixed a bug where the request headers for subsequent function calls within the same Client instance would not always be cleared
2021-01-24 17:58:23 +01:00

View File

@@ -12,7 +12,7 @@ namespace UniFi_API;
*
* @package UniFi_Controller_API_Client_Class
* @author Art of WiFi <info@artofwifi.net>
* @version Release: 1.1.66
* @version Release: 1.1.68
* @license This class is subject to the MIT license that is bundled with this package in the file LICENSE.md
* @example This directory in the package repository contains a collection of examples:
* https://github.com/Art-of-WiFi/UniFi-API-client/tree/master/examples
@@ -22,7 +22,7 @@ class Client
/**
* private and protected properties
*/
private $class_version = '1.1.66';
private $class_version = '1.1.68';
protected $baseurl = 'https://127.0.0.1:8443';
protected $user = '';
protected $password = '';
@@ -3071,7 +3071,7 @@ class Client
}
/**
* Toggle Element Adoption ON or OFF
* Toggle Element Adoption ON or OFF
*
* @param bool $enable true enables Element Adoption, false disables Element Adoption
* @return bool true on success
@@ -3759,7 +3759,8 @@ class Client
return false;
}
$json_payload = '';
$this->headers = [];
$json_payload = '';
if ($this->is_unifi_os) {
$url = $this->baseurl . '/proxy/network' . $path;
@@ -3777,9 +3778,8 @@ class Client
/**
* what we do when a payload is passed
*/
if (!is_null($payload)) {
if (!empty($payload)) {
$json_payload = json_encode($payload, JSON_UNESCAPED_SLASHES);
$curl_options[CURLOPT_POST] = true;
$curl_options[CURLOPT_POSTFIELDS] = $json_payload;
$this->headers = [