From a1577aec5915704a62b58119ef3246e495182b19 Mon Sep 17 00:00:00 2001 From: TakeshiDaveau Date: Thu, 28 Mar 2024 11:00:51 +0100 Subject: [PATCH 1/2] fix: reset query params before generate the query --- src/Clients/GenericClient.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Clients/GenericClient.php b/src/Clients/GenericClient.php index 36bf099..3a6bc6d 100644 --- a/src/Clients/GenericClient.php +++ b/src/Clients/GenericClient.php @@ -249,6 +249,7 @@ protected function setApiVersion($apiVersion) */ protected function setQueryParams(array $params) { + $this->queryParameters = []; $notAllowedParameters = array_diff_key($params, array_flip($this->possibleQueryParameters)); if (!empty($notAllowedParameters)) { throw new QueryParamsException($notAllowedParameters, $this->possibleQueryParameters); From 209cca4a7ea559451b37f0d26427998ac2e19241 Mon Sep 17 00:00:00 2001 From: jmcollin Date: Wed, 17 Apr 2024 17:22:56 +0200 Subject: [PATCH 2/2] fix: query params to generate the query --- src/Clients/GenericClient.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Clients/GenericClient.php b/src/Clients/GenericClient.php index 3a6bc6d..79c1168 100644 --- a/src/Clients/GenericClient.php +++ b/src/Clients/GenericClient.php @@ -208,7 +208,7 @@ protected function setRoute($route) { $this->route = $route; if ($this->getQueryParameters()) { - $this->route .= $this->getQueryParameters(); + $this->route .= '?' . http_build_query($this->getQueryParameters()); } return $this; @@ -249,14 +249,13 @@ protected function setApiVersion($apiVersion) */ protected function setQueryParams(array $params) { - $this->queryParameters = []; $notAllowedParameters = array_diff_key($params, array_flip($this->possibleQueryParameters)); if (!empty($notAllowedParameters)) { throw new QueryParamsException($notAllowedParameters, $this->possibleQueryParameters); } $filteredParams = array_intersect_key($params, array_flip($this->possibleQueryParameters)); - $this->queryParameters = '?' . http_build_query(array_merge($this->queryParameters, $filteredParams)); + $this->queryParameters = array_merge($this->queryParameters, $filteredParams); return $this; }