From 6bf0b22195da5dd0a0f9fb219f9dd530373502a3 Mon Sep 17 00:00:00 2001 From: Derek Perkins Date: Sat, 21 Jun 2014 08:31:32 -0600 Subject: [PATCH] Add setInput function to CakeRequest Modify data originally from `php://input`. Useful for altering json/xml data in middleware or DispatcherFilters before it gets to RequestHandlerComponent or other controllers. --- lib/Cake/Network/CakeRequest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index 672a6799a..b0aa86105 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -915,6 +915,17 @@ class CakeRequest implements ArrayAccess { return $input; } +/** + * Modify data originally from `php://input`. Useful for altering json/xml data + * in middleware or DispatcherFilters before it gets to RequestHandlerComponent + * + * @param string $input A string to replace original parsed data from input() + * @return void + */ + public function setInput($input) { + $this->_input = $input; + } + /** * Allow only certain HTTP request methods. If the request method does not match * a 405 error will be shown and the required "Allow" response header will be set.