From: Hypolite Petovan Date: Tue, 24 Aug 2021 15:30:11 +0000 (-0400) Subject: Allow a GuzzleResponse body to be queried more than once X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=17944c01ea8a9d03dd3b69a00f9c93df3210f85c;p=friendica.git 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 --- diff --git a/src/Network/GuzzleResponse.php b/src/Network/GuzzleResponse.php index b68f2e8435..3b41f6f654 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(); } }