[BrowserKit] Uppercase the "GET" method in redirects
This commit is contained in:
parent
37cd583e78
commit
7b117d3320
@ -455,7 +455,7 @@ abstract class Client
|
|||||||
$request = $this->internalRequest;
|
$request = $this->internalRequest;
|
||||||
|
|
||||||
if (in_array($this->internalResponse->getStatus(), array(302, 303))) {
|
if (in_array($this->internalResponse->getStatus(), array(302, 303))) {
|
||||||
$method = 'get';
|
$method = 'GET';
|
||||||
$files = array();
|
$files = array();
|
||||||
$content = null;
|
$content = null;
|
||||||
} else {
|
} else {
|
||||||
@ -464,7 +464,7 @@ abstract class Client
|
|||||||
$content = $request->getContent();
|
$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
|
// Don't forward parameters for GET request as it should reach the redirection URI
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
} else {
|
} else {
|
||||||
|
@ -410,7 +410,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
|
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
|
||||||
$client->request('POST', 'http://www.example.com/foo/foobar', array('name' => 'bar'));
|
$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');
|
$this->assertEquals(array(), $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user