Skip to content

Commit 8057c7c

Browse files
KurtThiemannfabpot
authored andcommitted
[HttpClient] Test POST to GET redirects
1 parent f4f6d81 commit 8057c7c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Tests/HttpClientTestCase.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,4 +673,26 @@ public function testHeadRequestWithClosureBody()
673673
$this->assertIsArray($vars);
674674
$this->assertSame('HEAD', $vars['REQUEST_METHOD']);
675675
}
676+
677+
/**
678+
* @testWith [301]
679+
* [302]
680+
* [303]
681+
*/
682+
public function testPostToGetRedirect(int $status)
683+
{
684+
$p = TestHttpServer::start(8067);
685+
686+
try {
687+
$client = $this->getHttpClient(__FUNCTION__);
688+
689+
$response = $client->request('POST', 'http://localhost:8057/custom?status=' . $status . '&headers[]=Location%3A%20%2F');
690+
$body = $response->toArray();
691+
} finally {
692+
$p->stop();
693+
}
694+
695+
$this->assertSame('GET', $body['REQUEST_METHOD']);
696+
$this->assertSame('/', $body['REQUEST_URI']);
697+
}
676698
}

0 commit comments

Comments
 (0)