Update lib/endpoint.php

This commit is contained in:
Bruno Rybársky 2024-04-11 15:18:17 +02:00
parent e4c37a8c2d
commit 638f092432

@ -26,7 +26,8 @@ function getEndpoint($endpoint_name): string
if (file_exists($endpoint_file)){ if (file_exists($endpoint_file)){
$output_tmp = runEndpoint($endpoint_file); $output_tmp = runEndpoint($endpoint_file);
$output["Endpoint"] = $endpoint_name; $output["Endpoint"] = $endpoint_name;
switch (gettype($output_tmp)) { $type = gettype($output_tmp);
switch ($type) {
case 'string': case 'string':
$output = $output_tmp; $output = $output_tmp;
$output['Status'] = 'Success'; $output['Status'] = 'Success';
@ -37,6 +38,7 @@ function getEndpoint($endpoint_name): string
default: default:
$output['Status'] = 'Fail'; $output['Status'] = 'Fail';
$output["Error"] = "Endpoint error"; $output["Error"] = "Endpoint error";
$output["Type"] = $type;
http_response_code(500); http_response_code(500);
} }
} }