Debugger shows, that there is POST data in request, but I cannot get it by $request->get('foo');
And $request->request->all();
gives array [0]
.
My Ajax POST request (by AngularJS):
...
$http.post('http://admin/about-company/setJSONObj',
{foo: 'bar'}
);
My controller with debugging info in comments (Symfony 3.2.9):
use Symfony\Component\HttpFoundation\Request;
...
public function updateAction(Request $request)
{
$foo = $request->get('foo'); // null
$requestType = $request->getContentType(); // json
$content = $request->getContent(); // {"foo":"bar"}
I used these approach on Symfony 2.7 project, and it worked fine, but I'm not sure, what's happening in these case?
Also, maybe there is any Symfony framework config variable that tells not to parse POST data, or hides it during caching the request?