-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed as not planned
Closed as not planned
Copy link
Description
Symfony version(s) affected
7.2.1
Description
According to the ResponseInterface of the HttpClient, the getInfo call should contain "url (string) - the last effective URL of the request".
It does contain the url in both cases, but it returns the entered unredirected url when getContent() has not been called yet. If Response->getContent has been called, it will then return the correct url.
How to reproduce
Reproducer here: https://github.com/ThomasBerends/http_client_reproducable
There's two commands, app:expected and app:unexpected.
Expected:
$response = $this->httpClient->request('GET', "https://www.php.net/notfound");
// Fetch content
$response->getContent();
// Get the correct (redirected) url
dump($response->getInfo()['url']);
// "https://www.php.net/manual-lookup.php?pattern=notfound&lang=en&scope=404quickref"
Unexpected:
$response = $this->httpClient->request('GET', "https://www.php.net/notfound");
// Get the correct (redirected) url
dump($response->getInfo()['url']);
// "https://www.php.net/notfound"
Possible Solution
No response
Additional Context
No response