Skip to content

Commit

Permalink
[HttpClient] Test POST to GET redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtThiemann authored and fabpot committed Dec 9, 2024
1 parent f4f6d81 commit 8057c7c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Tests/HttpClientTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,26 @@ public function testHeadRequestWithClosureBody()
$this->assertIsArray($vars);
$this->assertSame('HEAD', $vars['REQUEST_METHOD']);
}

/**
* @testWith [301]
* [302]
* [303]
*/
public function testPostToGetRedirect(int $status)
{
$p = TestHttpServer::start(8067);

try {
$client = $this->getHttpClient(__FUNCTION__);

$response = $client->request('POST', 'http://localhost:8057/custom?status=' . $status . '&headers[]=Location%3A%20%2F');
$body = $response->toArray();
} finally {
$p->stop();
}

$this->assertSame('GET', $body['REQUEST_METHOD']);
$this->assertSame('/', $body['REQUEST_URI']);
}
}

0 comments on commit 8057c7c

Please sign in to comment.