Add documentation for POST raw JSON data #2396

Closed
wants to merge 1 commit into
from

3 participants

@tvlooy

Add documentation for POST raw JSON data

Q A
Doc fix? no
New docs? yes
Applies to all
Fixed tickets #2368
@wouterj
Symfony member

👍 our first hackday PR!

Can you please add the pull request format

@stof stof commented on an outdated diff Mar 30, 2013
book/testing.rst
@@ -343,6 +343,9 @@ 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(), '{"title":"Hello World!"');
@stof
Symfony member
stof added a line comment Mar 30, 2013

you should add the closing curly brace to send a valid JSON string.

And you should probably add the header for the content type too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weaverryan
Symfony member

Hi Tom!

Looks awesome! I've patched this into the 2.0 branch at sha: 1bc1540

Thanks!

@weaverryan weaverryan closed this Mar 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment