After upgrading to CakepPHP 4.0 my POST request trough XMLHttpRequest stopped passing data to $this->request->getData()
The data is accesible by $this->request->input('json_decode');
though and GET requests work as well.
But I wonder what has changed in comparision to 3.* and why it's not working like it was before.
This is my xhr:
this.$http.post(
url,
data,
{headers: {'X-CSRF-TOKEN': '<?= $this->request->getAttribute('csrfToken') ?>'}},
})
.then(response => {
//
}
);
It gives me an empty array when I call $this->request->getData()
I tried to turn off FormProtection component for that specific action but nothing changed.