From f54c89c530294b734c82d7bf75eee958dd79608d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 10 Mar 2019 23:05:13 +0100 Subject: [PATCH] [HttpClient] add missing test case --- .../HttpClient/Test/HttpClientTestCase.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php index fb63a9f07d..2f79d6f9af 100644 --- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php +++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php @@ -399,6 +399,21 @@ abstract class HttpClientTestCase extends TestCase $this->assertSame('http://localhost:8057/post', $steps[0][2]['url']); } + public function testPostJson() + { + $client = $this->getHttpClient(); + + $response = $client->request('POST', 'http://localhost:8057/post', [ + 'json' => ['foo' => 'bar'], + ]); + + $body = $response->toArray(); + + $this->assertContains('json', $body['content-type']); + unset($body['content-type']); + $this->assertSame(['foo' => 'bar', 'REQUEST_METHOD' => 'POST'], $body); + } + public function testPostArray() { $client = $this->getHttpClient();