From 727249f738e82504ad3e63c4caa7212597f83172 Mon Sep 17 00:00:00 2001 From: Adrien Bensaibi Date: Tue, 19 Jan 2016 13:10:44 +0000 Subject: [PATCH] Add content from QueryString to build valide signature Signed-off-by: Adrien Bensaibi --- src/Api.php | 3 ++- tests/ApiFunctionalTest.php | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Api.php b/src/Api.php index 9179113..a8e254f 100644 --- a/src/Api.php +++ b/src/Api.php @@ -232,7 +232,8 @@ class Api $query = array_merge($query, (array)$content); $query = \GuzzleHttp\Psr7\build_query($query); - $request = $request->withUri($request->getUri()->withQuery($query)); + $url = $request->getUri()->withQuery($query); + $request = $request->withUri($url); $body = ""; } elseif (isset($content)) { $body = json_encode($content); diff --git a/tests/ApiFunctionalTest.php b/tests/ApiFunctionalTest.php index 651dd8c..85a1f1b 100644 --- a/tests/ApiFunctionalTest.php +++ b/tests/ApiFunctionalTest.php @@ -242,4 +242,12 @@ class ApiFunctionalTest extends \PHPUnit_Framework_TestCase $this->api->get('/me/accessRestriction/ip', ['foo' => 'bar']); } + + /** + * Test Api::get, should build valide signature + */ + public function testApiGetWithQueryString() + { + $this->api->get('/me/api/credential', ['status' => 'pendingValidation']); + } }