I use the client-Object to simulate and test my Silex-Webservices. How can I send a JSON-Body with the PUT-method?
My idea was:
$crawler = $this->client->request('PUT', '/test', array(), array(), array(), '{"id":"34"}');
That does not work. :(
Please try to use this code:
$client->request(
'PUT', '/test', array(), array(),
array(
'CONTENT_TYPE' => 'application/json',
'HTTP_X-Requested-With' => 'XMLHttpRequest'
),
'{"id":"34"}'
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With