@@ -473,6 +473,26 @@ public function testFollowRedirectWithPort()
473
473
$ this ->assertEquals ($ headers , $ client ->getRequest ()->getServer ());
474
474
}
475
475
476
+ public function testFollowRedirectWithPostMethod ()
477
+ {
478
+ $ parameters = array ('foo ' => 'bar ' );
479
+ $ files = array ('myfile.foo ' => 'baz ' );
480
+ $ server = array ('X_TEST_FOO ' => 'bazbar ' );
481
+ $ content = 'foobarbaz ' ;
482
+
483
+ $ client = new TestClient ();
484
+
485
+ $ client ->setNextResponse (new Response ('' , 307 , array ('Location ' => 'http://www.example.com/redirected ' )));
486
+ $ client ->request ('POST ' , 'http://www.example.com/foo/foobar ' , $ parameters , $ files , $ server , $ content );
487
+
488
+ $ this ->assertEquals ('http://www.example.com/redirected ' , $ client ->getRequest ()->getUri (), '->followRedirect() follows a redirect with POST method ' );
489
+ $ this ->assertArrayHasKey ('foo ' , $ client ->getRequest ()->getParameters (), '->followRedirect() keeps parameters with POST method ' );
490
+ $ this ->assertArrayHasKey ('myfile.foo ' , $ client ->getRequest ()->getFiles (), '->followRedirect() keeps files with POST method ' );
491
+ $ this ->assertArrayHasKey ('X_TEST_FOO ' , $ client ->getRequest ()->getServer (), '->followRedirect() keeps $_SERVER with POST method ' );
492
+ $ this ->assertEquals ($ content , $ client ->getRequest ()->getContent (), '->followRedirect() keeps content with POST method ' );
493
+ $ this ->assertEquals ('POST ' , $ client ->getRequest ()->getMethod (), '->followRedirect() keeps request method ' );
494
+ }
495
+
476
496
public function testBack ()
477
497
{
478
498
$ client = new TestClient ();
0 commit comments