bug #19425 [BrowserKit] Uppercase the "GET" method in redirects (jakzal)

This PR was merged into the 2.7 branch.

Discussion
----------

[BrowserKit] Uppercase the "GET" method in redirects

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19419
| License       | MIT
| Doc PR        | -

Commits
-------

7b117d3 [BrowserKit] Uppercase the "GET" method in redirects
This commit is contained in:
Nicolas Grekas 2016-07-25 18:04:00 +02:00
commit 27d416d79e
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');
}