Skip to content

Commit

Permalink
bug #19425 [BrowserKit] Uppercase the "GET" method in redirects (jakzal)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicolas-grekas committed Jul 25, 2016
2 parents 37cd583 + 7b117d3 commit 27d416d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/BrowserKit/Client.php
Expand Up @@ -455,7 +455,7 @@ public function followRedirect()
$request = $this->internalRequest;

if (in_array($this->internalResponse->getStatus(), array(302, 303))) {
$method = 'get';
$method = 'GET';
$files = array();
$content = null;
} else {
Expand All @@ -464,7 +464,7 @@ public function followRedirect()
$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 {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/BrowserKit/Tests/ClientTest.php
Expand Up @@ -410,7 +410,7 @@ public function testFollowRedirectWithMaxRedirects()
$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');
}

Expand Down

0 comments on commit 27d416d

Please sign in to comment.