From 359d6e388e79d008cb9e342d6448f1bb497a25b4 Mon Sep 17 00:00:00 2001 From: Tom Van Looy Date: Sun, 31 Mar 2013 10:28:37 +0200 Subject: [PATCH] POST JSON data --- book/testing.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/book/testing.rst b/book/testing.rst index 290a211205a..df575554168 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -343,6 +343,16 @@ or perform more complex requests:: // Directly submit a form (but using the Crawler is easier!) $client->request('POST', '/submit', array('name' => 'Fabien')); + // Submit a raw JSON string + $client->request( + 'POST', + '/submit', + array(), + array(), + array('CONTENT_TYPE' => 'application/json'), + '{"name":"Fabien"}' + ); + // Form submission with a file upload use Symfony\Component\HttpFoundation\File\UploadedFile;