Reputation: 777
I have this legacy code in Symfony 2. I don't know much about Symfony and I have this requests that have JSON formatted content, but the header has content type: application/x-www-form-urlencoded; charset=UTF-8. I need to change this to application/json, but I can't find where Symfony dispatches the request to the server.
Upvotes: 0
Views: 5119
Reputation: 9191
You can do something like this,
use Symfony\Component\HttpFoundation\Response;
$response = new Response();
$response->headers->set('Content-Type', 'text/json');
$response->send();
Also, it is worth referring to Symfony's documentation Symfony HttpFoundation Component
Upvotes: 1