I am testing a RESTful API and should verify that the application parses incoming data correctly. The input data type can be in XML or JSON format. The application looks at the Content-Type value in the header to determine how the data will be processed.
Applatoin works well, but I cannot write a proper functional test for it in Symfony2, since I seem to be unable to set the Content-Type when the URL is called.
I am doing something like this:
$crawler = $client->request('PUT','/api/record/, array("data" => $xmlData), array(), array("Content-Type" => "text/xml"));
Until it throws any errors, my application cannot pick it up. I successfully tested my script with the Firefox Poster plugin as well as cUrl.
Any help / idea would be greatly appreciated.
source
share