From e706de5c8279432899bbc4fda33bdda79492acd0 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Fri, 16 Sep 2022 14:11:02 +0200 Subject: [PATCH] Added raw post body to api debugging --- lib/mvcfronk/mfBase/mfBaseApicontroller.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mvcfronk/mfBase/mfBaseApicontroller.php b/lib/mvcfronk/mfBase/mfBaseApicontroller.php index 2425c85e8..3fcfabc01 100644 --- a/lib/mvcfronk/mfBase/mfBaseApicontroller.php +++ b/lib/mvcfronk/mfBase/mfBaseApicontroller.php @@ -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;