Added raw post body to api debugging
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user