From 0506a231ec1a5105855f8c44489f15fefefa37b7 Mon Sep 17 00:00:00 2001 From: Romain Beuque Date: Tue, 19 Jan 2016 15:08:20 +0000 Subject: [PATCH] fix: incorrect query when passed from url and not from content Signed-off-by: Romain Beuque --- src/Api.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Api.php b/src/Api.php index a8e254f..e521cb5 100644 --- a/src/Api.php +++ b/src/Api.php @@ -223,11 +223,16 @@ class Api if (isset($content) && $method == 'GET') { - $queryString = $request->getUri()->getQuery(); + $query_string = $request->getUri()->getQuery(); - $query = false !== strpos($queryString, '&') - ? explode('&', $queryString) - : []; + $query = array(); + if ($query_string != '') { + $queries = explode('&', $query_string); + foreach($queries as $element) { + $key_value_query = explode('=', $element, 2); + $query[$key_value_query[0]] = $key_value_query[1]; + } + } $query = array_merge($query, (array)$content); $query = \GuzzleHttp\Psr7\build_query($query);