Strange behavior with passing defaults={"_format" = "xml"} to controller (seemed to work before):
/**
* @Route("/orderxml/{orderguid}", name="_show_order_xml", defaults={"_format" = "xml"})
*/
public function showOrderXML($orderguid)
{
....
$xmloutput = $this->container->get('templating')
->render($templateName, $tpl_data);
$response = new Response($xmloutput);
}
Though I pass defaults={"_format" = "xml"}, the response is still received with content-type=text/html.
Tried to debug the Request - it comes with empty Content-Type header. Attributes of Request do contain _format=xml, but also contain media-type="text/html", which is not familiar to me. As stated in the docs, _format determines the content-type of Request and Response objects.
Currently the only thing I could do is $response->headers->set('Content-Type', 'text/xml');
How can this be fixed?
P.S.: symfony 2.3