Skip to content

Commit

Permalink
[HttpClient] Fix buffering after calling AsyncContext::passthru()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Oct 18, 2022
1 parent 8a3929c commit 425763a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Response/AsyncContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@ public function replaceResponse(ResponseInterface $response): ResponseInterface

/**
* Replaces or removes the chunk filter iterator.
*
* @param ?callable(ChunkInterface, self): ?\Iterator $passthru
*/
public function passthru(callable $passthru = null): void
{
$this->passthru = $passthru;
$this->passthru = $passthru ?? static function ($chunk, $context) {
$context->passthru = null;

yield $chunk;
};
}
}

0 comments on commit 425763a

Please sign in to comment.