diff --git a/src/Results.php b/src/Results.php index 98d869f..4bdfc43 100644 --- a/src/Results.php +++ b/src/Results.php @@ -40,7 +40,7 @@ class Results public function __construct(ResponseInterface $response, $asArray = false) { $this->responseObject = $response; - $this->responseBody = $this->responseObject->getBody()->getContents(); + $this->responseBody = (string) $this->responseObject->getBody(); $this->results = json_decode($this->responseBody, $asArray); // Check if any errors exist, and throw exception if they do diff --git a/tests/ClientTest.php b/tests/ClientTest.php index c24e941..a2d52e3 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -79,7 +79,7 @@ public function testConstructClient() /** @var Request $firstRequest */ $firstRequest = $container[0]['request']; - $this->assertEquals('{"query":"query_string","variables":{}}', $firstRequest->getBody()->getContents()); + $this->assertEquals('{"query":"query_string","variables":{}}', (string) $firstRequest->getBody()); $this->assertSame('POST', $firstRequest->getMethod()); /** @var Request $thirdRequest */ @@ -92,7 +92,7 @@ public function testConstructClient() /** @var Request $secondRequest */ $secondRequest = $container[2]['request']; - $this->assertEquals('{"query":"query_string","variables":{"name":"val"}}', $secondRequest->getBody()->getContents()); + $this->assertEquals('{"query":"query_string","variables":{"name":"val"}}', (string) $secondRequest->getBody()); /** @var Request $fourthRequest */ $fourthRequest = $container[3]['request'];