Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Closed
Description
Symfony version(s) affected
6.4.17 / 7.2.2
Description
CallinggetContent
twice on theAsyncResponse
returned by theNoPrivateNetworkHttpClient
returns an empty string the second time the method is called if theNoPrivateNetworkHttpClient
is configured with the following options:['max_redirects' => 0]
.
This works fine withsymfony/http-client
6.4.15 and 6.4.16
How to reproduce
$httpClient =new \Symfony\Component\HttpClient\NoPrivateNetworkHttpClient(\Symfony\Component\HttpClient\HttpClient::create());$httpClient =$httpClient->withOptions(['max_redirects' =>0]);$response =$httpClient->request('GET','https://example.com');$content1 =$response->getContent();// $content1 will be the HTML body$content2 =$response->getContent();// $content2 will be an empty string
Possible Solution
Obviously not a solution but this works ok if I remove thereturn AsyncResponse(...
that was added in line 120 in this commitsymfony/http-client@d77d8e2
Additional Context
No response