raw_input_stream as array instead of stdobj & terminateWithSuccess

This commit is contained in:
cgfhtw
2024-02-01 08:59:35 +01:00
parent 51e556a731
commit fe798506a6
+12 -1
View File
@@ -87,7 +87,7 @@ class FHCAPI_Controller extends FHC_Controller
// For JSON Requests (as opposed to multipart/form-data) get the $_POST variable from the input stream instead
if ($this->input->get_request_header('Content-Type', true) == 'application/json')
$_POST = json_decode($this->security->xss_clean($this->input->raw_input_stream));
$_POST = json_decode($this->security->xss_clean($this->input->raw_input_stream), true);
}
@@ -159,6 +159,17 @@ class FHCAPI_Controller extends FHC_Controller
exit(EXIT_ERROR);
}
/**
* @param mixed $data (optional)
* @return void
*/
protected function terminateWithSuccess($data = null)
{
$this->setData($data);
$this->setStatus(self::STATUS_SUCCESS);
exit;
}
// TODO(chris): complete list