Skip to content

Commit

Permalink
[4.x] Rewind http client response after recording (#1114)
Browse files Browse the repository at this point in the history
* Update ClientRequestWatcher.php

* Update ClientRequestWatcher.php

Co-authored-by: Dries Vints <dries@vints.io>
  • Loading branch information
emargareten and driesvints authored Aug 12, 2021
1 parent 0a5afdf commit f195871
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Watchers/ClientRequestWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ protected function response(Response $response)
{
$content = $response->body();

$stream = $response->toPsrResponse()->getBody();

if ($stream->isSeekable()) {
$stream->rewind();
}

if (is_string($content)) {
if (is_array(json_decode($content, true)) &&
json_last_error() === JSON_ERROR_NONE) {
Expand Down

0 comments on commit f195871

Please sign in to comment.