8000 minor #35561 [HttpClient] dont display any content when none has been… · symfony/symfony@5da9cf3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5da9cf3

Browse files
minor #35561 [HttpClient] dont display any content when none has been 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
2 parents 00b6846 + 36536c9 commit 5da9cf3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ private function collectOnClient(TraceableHttpClient $client): array
145145
$content = [$content];
146146
}
147147

148-
$k = 'response_content';
148+
$content = ['response_content' => $content];
149+
} elseif (\is_array($content)) {
150+
$content = ['response_json' => $content];
149151
} else {
150-
$k = 'response_json';
152+
$content = [];
151153
}
152154

153155
$debugInfo = array_diff_key($info, $baseInfo);
154-
$info = ['info' => $debugInfo] + array_diff_key($info, $debugInfo) + [$k => $content];
156+
$info = ['info' => $debugInfo] + array_diff_key($info, $debugInfo) + $content;
155157
unset($traces[$i]['info']); // break PHP reference used by TraceableHttpClient
156158
$traces[$i]['info'] = $this->cloneVar($info);
157159
$traces[$i]['options'] = $this->cloneVar($trace['options']);

src/Symfony/Component/HttpClient/TraceableHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(HttpClientInterface $client)
3737
*/
3838
public function request(string $method, string $url, array $options = []): ResponseInterface
3939
{
40-
$content = '';
40+
$content = null;
4141
$traceInfo = [];
4242
$this->tracedRequests[] = [
4343
'method' => $method,

0 commit comments

Comments
 (0)
0