Skip to content

Commit 425763a

Browse files
[HttpClient] Fix buffering after calling AsyncContext::passthru()
1 parent 8a3929c commit 425763a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Response/AsyncContext.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,15 @@ public function replaceResponse(ResponseInterface $response): ResponseInterface
181181

182182
/**
183183
* Replaces or removes the chunk filter iterator.
184+
*
185+
* @param ?callable(ChunkInterface, self): ?\Iterator $passthru
184186
*/
185187
public function passthru(callable $passthru = null): void
186188
{
187-
$this->passthru = $passthru;
189+
$this->passthru = $passthru ?? static function ($chunk, $context) {
190+
$context->passthru = null;
191+
192+
yield $chunk;
193+
};
188194
}
189195
}

0 commit comments

Comments
 (0)