Added raw post body to api debugging

This commit is contained in:
Frank Schubert
2022-09-16 14:11:02 +02:00
parent 0d6abb53d5
commit e706de5c82

View File

@@ -20,6 +20,7 @@ class mfBaseApicontroller {
protected $headers = [];
protected $route;
protected $request_json;
protected $raw_post_body;
protected $get = [];
protected $post = [];
protected $format = "default";
@@ -93,6 +94,7 @@ class mfBaseApicontroller {
}
private function logRequest2() {
$this->requestLog->debug("POST Raw: ".$this->raw_post_body);
$this->requestLog->debug("POST JSON: ".$this->request_json);
$this->requestLog->debug("Headers: ".print_r($this->headers, true));
}
@@ -180,9 +182,9 @@ class mfBaseApicontroller {
}
private function getRequestBody() {
$this->raw_post_body = file_get_contents('php://input');
if(strtolower($this->headers['content-type']) == "application/json") {
$request_body = file_get_contents('php://input');
return $request_body;
return $this->raw_post_body;
}
return $_POST;