From 17944c01ea8a9d03dd3b69a00f9c93df3210f85c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 24 Aug 2021 11:30:11 -0400 Subject: [PATCH] Allow a GuzzleResponse body to be queried more than once - Using `StreamInterface->getContents` left the stream index at the end of the stream, which made every subsequent call to `getBody()` return empty string - Using `StreamInterface->__toString()` magic method correctly seek the stream to the start before reading --- src/Network/GuzzleResponse.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Network/GuzzleResponse.php b/src/Network/GuzzleResponse.php index b68f2e843..3b41f6f65 100644 --- a/src/Network/GuzzleResponse.php +++ b/src/Network/GuzzleResponse.php @@ -147,8 +147,8 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface } /// @todo - fix mismatching use of "getBody()" as string here and parent "getBody()" as streaminterface - public function getBody() + public function getBody(): string { - return parent::getBody()->getContents(); + return (string) parent::getBody(); } }