8000 [HttpClient] add missing test case · symfony/symfony@f54c89c · GitHub
[go: up one dir, main page]

Skip to content

Commit f54c89c

Browse files
[HttpClient] add missing test case
1 parent a96308f commit f54c89c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,21 @@ public function testOnProgress()
399399
$this->assertSame('http://localhost:8057/post', $steps[0][2]['url']);
400400
}
401401

402+
public function testPostJson()
403+
{
404+
$client = $this->getHttpClient();
405+
406+
$response = $client->request('POST', 'http://localhost:8057/post', [
407+
'json' => ['foo' => 'bar'],
408+
]);
409+
410+
$body = $response->toArray();
411+
412+
$this->assertContains('json', $body['content-type']);
413+
unset($body['content-type']);
414+
$this->assertSame(['foo' => 'bar', 'REQUEST_METHOD' => 'POST'], $body);
415+
}
416+
402417
public function testPostArray()
403418
{
404419
$client = $this->getHttpClient();

0 commit comments

Comments
 (0)
0