Skip to content

Commit

Permalink
Fixed Response::getRawData to handle seeksable strams correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Jan 27, 2017
1 parent 4e485b9 commit 095ffad
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Response.php
Expand Up @@ -26,7 +26,18 @@ class Response extends \hiqdev\hiart\proxy\Response

public function getRawData()
{
return $this->worker->getBody()->getContents();
$body = $this->worker->getBody();

if ($body->isSeekable()) {
$originalPosition = $body->tell();
$body->rewind();
$result = $body->getContents();
$body->seek($originalPosition);

return $result;
}

return $body->getContents();
}

public function __call($name, $args)
Expand Down

0 comments on commit 095ffad

Please sign in to comment.