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
This commit is contained in:
parent
e7fdf3c0c3
commit
17944c01ea
1 changed files with 2 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue