Skip to content

Commit

Permalink
minor #35561 [HttpClient] dont display any content when none has been…
Browse files Browse the repository at this point in the history
… collected (nicolas-grekas)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] dont display any content when none has been collected

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

36536c9 [HttpClient] dont display any content when none has been collected
  • Loading branch information
nicolas-grekas committed Feb 3, 2020
2 parents 00b6846 + 36536c9 commit 5da9cf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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
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 5da9cf3

Please sign in to comment.