From d142ab5deaa86d7e543a1a8e8e0b0ad3353aaf22 Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Sun, 25 Jul 2021 21:28:37 +0200 Subject: [PATCH] Fix patch method not getting parameters back Signed-off-by: Igor Ilic --- Request.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Request.php b/Request.php index d7dc1d9..8131e11 100644 --- a/Request.php +++ b/Request.php @@ -17,6 +17,15 @@ class Request public function __construct() { $input = json_decode(file_get_contents('php://input')) ?? []; + if ( $_SERVER['REQUEST_METHOD'] == 'PATCH' ) { + if ( isset($_REQUEST["parameters"]) ) { + $_REQUEST = array_merge($_REQUEST, $_REQUEST['parameters']); + } + + if ( isset($_REQUEST["files"]) ) { + $_REQUEST = array_merge($_REQUEST, $_REQUEST['files']); + } + } $_REQUEST = array_merge($_REQUEST, (array)$input); $this->data = $_REQUEST; }