Skip to content

Commit

Permalink
[HttpClient] dont display any content when none has been collected
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Feb 2, 2020
1 parent fb732df commit 36536c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ private function collectOnClient(TraceableHttpClient $client): array
$content = [$content];
}

$k = 'response_content';
$content = ['response_content' => $content];
} elseif (\is_array($content)) {
$content = ['response_json' => $content];
} else {
$k = 'response_json';
$content = [];
}

$debugInfo = array_diff_key($info, $baseInfo);
$info = ['info' => $debugInfo] + array_diff_key($info, $debugInfo) + [$k => $content];
$info = ['info' => $debugInfo] + array_diff_key($info, $debugInfo) + $content;
unset($traces[$i]['info']); // break PHP reference used by TraceableHttpClient
$traces[$i]['info'] = $this->cloneVar($info);
$traces[$i]['options'] = $this->cloneVar($trace['options']);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpClient/TraceableHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(HttpClientInterface $client)
*/
public function request(string $method, string $url, array $options = []): ResponseInterface
{
$content = '';
$content = null;
$traceInfo = [];
$this->tracedRequests[] = [
'method' => $method,
Expand Down

0 comments on commit 36536c9

Please sign in to comment.