From 7b117d332004c9cdf5619b0e019899e654ccc81c Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 25 Jul 2016 14:54:45 +0100 Subject: [PATCH] [BrowserKit] Uppercase the "GET" method in redirects --- src/Symfony/Component/BrowserKit/Client.php | 4 ++-- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 85e36269244d..c69599083802 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -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 { @@ -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 { diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index f2b2a41d0a9e..94e6983fbd00 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -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'); }