Merge pull request #24 from limenet/master

Don't double JSON-encode the request
This commit is contained in:
Junade
2017-10-07 00:03:10 +01:00
committed by GitHub
2 changed files with 4 additions and 8 deletions

View File

@@ -67,13 +67,11 @@ class Guzzle implements Adapter
*/
public function put(String $uri, array $headers = [], array $body = []): ResponseInterface
{
$jsonBody = json_encode($body);
$response = $this->client->put(
$uri,
[
'headers' => $headers,
'json' => $jsonBody
'json' => $body
]
);
@@ -86,13 +84,11 @@ class Guzzle implements Adapter
*/
public function patch(String $uri, array $headers = [], array $body = []): ResponseInterface
{
$jsonBody = json_encode($body);
$response = $this->client->patch(
$uri,
[
'headers' => $headers,
'json' => $jsonBody
'json' => $body
]
);

View File

@@ -58,7 +58,7 @@ class GuzzleTest extends TestCase
$this->assertEquals("application/json", $headers["Content-Type"][0]);
$body = json_decode($response->getBody());
$this->assertEquals("Testing a PUT request.", json_decode($body->json)->{"X-Put-Test"});
$this->assertEquals("Testing a PUT request.", $body->json->{"X-Put-Test"});
}
public function testPatch()
@@ -73,7 +73,7 @@ class GuzzleTest extends TestCase
$this->assertEquals("application/json", $headers["Content-Type"][0]);
$body = json_decode($response->getBody());
$this->assertEquals("Testing a PATCH request.", json_decode($body->json)->{"X-Patch-Test"});
$this->assertEquals("Testing a PATCH request.", $body->json->{"X-Patch-Test"});
}
public function testDelete()