Skip to content

Commit 1bc1540

Browse files
tvlooyweaverryan
authored andcommitted
POST JSON data
1 parent 6f9be2c commit 1bc1540

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

book/testing.rst

+10
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,16 @@ or perform more complex requests::
344344
// Directly submit a form (but using the Crawler is easier!)
345345
$client->request('POST', '/submit', array('name' => 'Fabien'));
346346

347+
// Submit a raw JSON string
348+
$client->request(
349+
'POST',
350+
'/submit',
351+
array(),
352+
array(),
353+
array('CONTENT_TYPE' => 'application/json'),
354+
'{"name":"Fabien"}'
355+
);
356+
347357
// Form submission with a file upload
348358
use Symfony\Component\HttpFoundation\File\UploadedFile;
349359

0 commit comments

Comments
 (0)