diff --git a/webfiori/http/APITestCase.php b/webfiori/http/APITestCase.php index 5b39f24..2dcb63f 100644 --- a/webfiori/http/APITestCase.php +++ b/webfiori/http/APITestCase.php @@ -84,13 +84,7 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod, $apiEndpointName = $service->getName(); } } - if ($method == RequestMethod::GET || $method == RequestMethod::DELETE) { - foreach ($parameters as $key => $val) { - $_GET[$key] = $this->parseVal($val); - } - $_GET['service'] = $apiEndpointName; - $this->unset($_GET, $parameters, $manager); - } else if ($method == RequestMethod::POST || $method == RequestMethod::PUT || $method == RequestMethod::PATCH) { + if ($method == RequestMethod::POST || $method == RequestMethod::PUT || $method == RequestMethod::PATCH) { foreach ($parameters as $key => $val) { $_POST[$key] = $this->parseVal($val); } @@ -98,7 +92,11 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod, $_SERVER['CONTENT_TYPE'] = 'multipart/form-data'; $this->unset($_POST, $parameters, $manager); } else { - $manager->process(); + foreach ($parameters as $key => $val) { + $_GET[$key] = $this->parseVal($val); + } + $_GET['service'] = $apiEndpointName; + $this->unset($_GET, $parameters, $manager); } $retVal = $manager->readOutputStream(); diff --git a/webfiori/http/WebServicesManager.php b/webfiori/http/WebServicesManager.php index 2d8efa7..3ebcf19 100644 --- a/webfiori/http/WebServicesManager.php +++ b/webfiori/http/WebServicesManager.php @@ -988,10 +988,14 @@ private function getAction() { foreach ($serviceIdx as $serviceNameIndex) { if (($reqMeth == RequestMethod::GET || $reqMeth == RequestMethod::DELETE || - $reqMeth == RequestMethod::OPTIONS || - $reqMeth == RequestMethod::PATCH) && isset($_GET[$serviceNameIndex])) { + $reqMeth == RequestMethod::CONNECT || + $reqMeth == RequestMethod::HEAD || + $reqMeth == RequestMethod::TRACE || + $reqMeth == RequestMethod::OPTIONS) && isset($_GET[$serviceNameIndex])) { $retVal = filter_var($_GET[$serviceNameIndex]); - } else if (($reqMeth == RequestMethod::POST || $reqMeth == RequestMethod::PUT) && isset($_POST[$serviceNameIndex])) { + } else if (($reqMeth == RequestMethod::POST || + $reqMeth == RequestMethod::PUT || + $reqMeth == RequestMethod::PATCH) && isset($_POST[$serviceNameIndex])) { $retVal = filter_var($_POST[$serviceNameIndex]); } }