Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PhpBrowser uses wrong port when redirects disabled and base url is identical #4383
What are you trying to achieve?
I access with PhpBrowser the same page, but with two different ports. I disable redirects.
What do you get instead?
For the second call, the port of the first call is used, not the port of the second call.
The code below should first do a call on port 8110, and then on port 8112. But it does the second call also on port 8110 (even though the debug output claims it is 8112).
If between the two calls I do a:
Then the correct port is used for the second call.
$I->setRedirects(false); // this does a: getModule('PhpBrowser')->client->followRedirects(false); $I->amOnUrl('http://bla.com:8110'); $I->seeResponseCodeIs(301); $I->amOnUrl('http://bla.com:8112'); $I->seeResponseCodeIs(200);
Wild guess: the issue seems to be in the getAbsoluteUri method of the Guzzle6.php. For the second call it returns the Uri of the history (line 172), which is wrong, since that one has the old port.
actor: Sandbox2Tester modules: enabled: - \Helper\Sandbox2 - \Helper\OverallHelper - PhpBrowser: url: 'foo'
Your bug report is way overcomplicated, this issue happens because the second url has an empty path component.
I simplified testcase to
$I->amOnUrl('https://www.example.com'); $I->see('Example Domain'); $I->amOnUrl('http://www.codeception.com'); $I->dontSee('Example Domain');
Appending / to second URL makes it work as expected.