When I send data to a server redirect, it happens:
$view = $this->routeRedirectView('get_config', array('id' => $config->getId())); return $this->handleView($view);
Here is the action code in which the request is redirected to:
public function getConfigAction($id) { $config = $this->getConfigById($id); return array('configs' => array($config)); }
Creation works correctly. However, the redirection does not work as we would like it to work. When I execute the following command
curl -v -H "Accept: application/xml" -H "Content-type: application/json" -X POST \ -d '{"config": {"name": "TEST1"}}' http://localhost:8888/app_dev.php/configs
Output:
< HTTP/1.0 201 Created < Date: Wed, 19 Dec 2012 14:13:17 GMT < location: http:
I cannot control the response to contain a newly created object. Here is the desired result:
< HTTP/1.0 201 Created < Date: Wed, 19 Dec 2012 14:13:17 GMT < location: http://localhost:8888/app_dev.php/configs/12 <?xml version="1.0" encoding="UTF-8"?> <result> <entry> <entry> <id>12</id> <name><![CDATA[TEST1]]></name> </entry> </entry> </result>
source share