[BrowserKit] Uppercase the "GET" method in redirects

This commit is contained in:
Jakub Zalas 2016-07-25 14:54:45 +01:00
parent 37cd583e78
commit 7b117d3320
2 changed files with 3 additions and 3 deletions

View File

@ -455,7 +455,7 @@ abstract class Client
$request = $this->internalRequest;
if (in_array($this->internalResponse->getStatus(), array(302, 303))) {
$method = 'get';
$method = 'GET';
$files = array();
$content = null;
} else {
@ -464,7 +464,7 @@ abstract class Client
$content = $request->getContent();
}
if ('get' === strtolower($method)) {
if ('GET' === strtoupper($method)) {
// Don't forward parameters for GET request as it should reach the redirection URI
$parameters = array();
} else {

View File

@ -410,7 +410,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
$client->request('POST', 'http://www.example.com/foo/foobar', array('name' => 'bar'));
$this->assertEquals('get', $client->getRequest()->getMethod(), '->followRedirect() uses a get for 302');
$this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302');
$this->assertEquals(array(), $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
}