Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpClient] NoPrivateNetworkHttpClient with max_redirects = 0 returns empty content an the second call #59574

Closed
@glaubinix

Description

@glaubinix

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp