mirror of
https://github.com/friendica/friendica
synced 2025-04-19 07:10:11 +00:00
Add a second parameter to BaseApi::getRequest to enable API tests
This commit is contained in:
parent
d83ebe6031
commit
9cc675233d
40 changed files with 45 additions and 41 deletions
|
@ -108,12 +108,16 @@ class BaseApi extends BaseModule
|
|||
/**
|
||||
* Processes data from GET requests and sets defaults
|
||||
*
|
||||
* @param array $defaults Associative array of expected request keys and their default typed value. A null
|
||||
* value will remove the request key from the resulting value array.
|
||||
* @param array|null $request Custom REQUEST array, superglobal instead
|
||||
* @return array request data
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getRequest(array $defaults)
|
||||
public static function getRequest(array $defaults, array $request = null): array
|
||||
{
|
||||
$httpinput = HTTPInputData::process();
|
||||
$input = array_merge($httpinput['variables'], $httpinput['files'], $_REQUEST);
|
||||
$input = array_merge($httpinput['variables'], $httpinput['files'], $request ?? $_REQUEST);
|
||||
|
||||
self::$request = $input;
|
||||
self::$boundaries = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue