mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
commit
b06d297216
2 changed files with 28 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -2081,7 +2081,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
|
||||
/**
|
||||
* Data provider for testing reading values with CakeRequest::param()
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function paramReadingDataProvider() {
|
||||
|
@ -2218,6 +2218,22 @@ class CakeRequestTest extends CakeTestCase {
|
|||
$this->assertEquals('/posts/base_path/1/name:value?test=value', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the input() method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetInput() {
|
||||
$request = new CakeRequest('/');
|
||||
|
||||
$request->setInput('I came from setInput');
|
||||
$result = $request->input();
|
||||
$this->assertEquals('I came from setInput', $result);
|
||||
|
||||
$result = $request->input();
|
||||
$this->assertEquals('I came from setInput', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the input() method.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue