I have a web application written in CakePHP that needs to read request data from a JSON payload as opposed to standard application/x-www-form-urlencoded data. I would like to be able to access this data via the standard $this->request->data methodology. Is there a supported way to extend the CakeRequest object so that it is able to accept requests in this format?
Share
Here’s how you can customize the CakeRequest object’s functionality:
Insert the following into app/Config/bootstrap.php:
Create app/Lib/Network, and add AppCakeRequest.php:
Edit app/webroot/index.php:
Be careful, make sure you know what you’re doing, and good luck.