From 595e9c131673703fd7f5dd14ee821fc06b39f000 Mon Sep 17 00:00:00 2001 From: kj Date: Thu, 20 Feb 2025 08:21:05 -0300 Subject: [PATCH] Save body request as a property. --- src/Libs/Request.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Libs/Request.php b/src/Libs/Request.php index eb7a938..c837afa 100644 --- a/src/Libs/Request.php +++ b/src/Libs/Request.php @@ -22,6 +22,7 @@ class Request extends Neuron { public Neuron $params; public string $path; public string $error; + public string $body; public array $next; /** @@ -37,11 +38,12 @@ class Request extends Neuron { $this->put = new Neuron(); $this->patch = new Neuron(); $this->delete = new Neuron(); + $this->body = file_get_contents("php://input"); $contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : ''; if ($contentType === "application/json") $this->json = new Neuron( - (object) json_decode(trim(file_get_contents("php://input")), false) + (object) json_decode(trim($this->body), false) ); else { $this->json = new Neuron();