Skip to content

Commit a109263

Browse files
follow symfony/symfony#47990 precaution
1 parent fac85e1 commit a109263

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/HttpClient/HttpClientRequestIdLogger.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@ public function __construct(
2727
*/
2828
public function request(string $method, string $url, array $options = []): ResponseInterface
2929
{
30-
return new AsyncResponse($this->client, $method, $url, $options, function (ChunkInterface $chunk, AsyncContext $asyncContext) {
31-
if ($chunk->isTimeout() || null !== $chunk->getInformationalStatus() || $asyncContext->getInfo('canceled')) {
30+
return new AsyncResponse($this->client, $method, $url, $options, function (ChunkInterface $chunk, AsyncContext $context) {
31+
// @see https://github.com/symfony/symfony/pull/47990/commits/e100562fed39ee64fee523b2eacf6ec361429bad#r1004799422
32+
if ($context->getInfo('canceled') || $chunk->isTimeout() || null !== $chunk->getInformationalStatus()) {
3233
yield $chunk;
3334

3435
return;
3536
}
3637

3738
if ($chunk->isFirst()) {
38-
$headers = $asyncContext->getHeaders();
39+
$headers = $context->getHeaders();
3940

4041
foreach ($this->headerNames as $headerName) {
4142
if (\array_key_exists($headerName, $headers)) {
4243
foreach ($headers[$headerName] as $header) {
43-
$info = $asyncContext->getInfo();
44+
$info = $context->getInfo();
4445

4546
$this->logger->debug(\sprintf('Response %s, Request-ID: %s', $info['url'], $header));
4647
}

0 commit comments

Comments
 (0)