Skip to content

Commit

Permalink
fix: Added Patch Request Method + Process for Others
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed Aug 29, 2024
1 parent d33836e commit b93e607
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webfiori/http/APITestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,21 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod,
$apiEndpointName = $service->getName();
}
}
if ($method == 'GET' || $method == 'DELETE') {
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 == 'POST' || $method == 'PUT') {
} else if ($method == RequestMethod::POST || $method == RequestMethod::PUT || $method == RequestMethod::PATCH) {
foreach ($parameters as $key => $val) {
$_POST[$key] = $this->parseVal($val);
}
$_POST['service'] = $apiEndpointName;
$_SERVER['CONTENT_TYPE'] = 'multipart/form-data';
$this->unset($_POST, $parameters, $manager);
} else {
$manager->process();
}

$retVal = $manager->readOutputStream();
Expand Down

0 comments on commit b93e607

Please sign in to comment.