Closed
Description
Symfony version(s) affected
≥ 6.3.0
Description
When investigating #51360 I found out the HttpClientTrait::normalizeBody
checks if upload streams have ended when they are nested in body
(cf. #49911).
In that case, the HttpClientDataCollector
will trigger an exception because it will call normalizeBody
again when all streams have been read (to generate the cURL command).
How to reproduce
$stream = fopen('filepath', 'r');
$httpClient->request('POST', '/endpoint', [
'body' => ['stream' => $stream],
]);
will trigger a TransportException
if the profiler is enabled.
Possible Solution
The HttpClientDataCollector
does not generate a cURL command when the body is a stream, so I guess it shouldn’t either in this case.