diff --git a/src/Rest/Client.php b/src/Rest/Client.php index c563153..e213ff4 100644 --- a/src/Rest/Client.php +++ b/src/Rest/Client.php @@ -40,9 +40,12 @@ class Client extends ZuoraClientBase { * Perform GET request. * * @param $uri - * @param array|NULL $body + * @param null $zuora_version + * The version of api to send in header. * * @return array|mixed + * @internal param array|NULL $body + * */ public function get($uri, $zuora_version = null) { return $this->httpRequest('GET', $uri, $zuora_version); @@ -54,6 +57,9 @@ class Client extends ZuoraClientBase { * @param $uri * @param array $body * + * @param null $zuora_version + * The version of api to send in header. + * * @return array|mixed */ public function post($uri, array $body, $zuora_version = null) { @@ -66,6 +72,9 @@ class Client extends ZuoraClientBase { * @param $uri * @param array $body * + * @param null $zuora_version + * The version of api to send in header. + * * @return array|mixed */ public function put($uri, array $body, $zuora_version = null) { @@ -79,9 +88,11 @@ class Client extends ZuoraClientBase { * @param $uri * @param array|NULL $body * - * @throws ZuoraException + * @param null $zuora_version + * The version of api to send in header. * * @return array|mixed + * @throws \Drupal\zuora\Exception\ZuoraException */ public function httpRequest($type, $uri, array $body = null, $zuora_version = null) { $response = $this->httpClient->request($type, '/' . self::ZUORA_API_VERSION . $uri, [ @@ -102,6 +113,9 @@ class Client extends ZuoraClientBase { /** * Returns HTTP request headers. * + * @param null $zuora_version + * The version of api to send in header. + * * @return array */ protected function httpHeaders($zuora_version = null) { @@ -110,9 +124,11 @@ class Client extends ZuoraClientBase { 'Content-Type' => 'application/json', 'apiAccessKeyId' => $this->zuoraConfig->get('access_key_id'), 'apiSecretAccessKey' => $this->zuoraConfig->get('access_secret_key'), - 'zuora-version' => $zuora_version, ]; - $headers = array_filter($headers); + if($zuora_version != NULL){ + $headers['zuora-version'] = $zuora_version; + } + $headers = $headers; return $headers; }