From 4ea8a8c2e486fe7331a9b4b52ff4f40b247b2f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 8 Oct 2023 15:33:14 +0800 Subject: [PATCH] eee --- src/Request.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Request.php b/src/Request.php index 3a4a6ce..3a3b771 100644 --- a/src/Request.php +++ b/src/Request.php @@ -35,7 +35,7 @@ class Request implements ServerRequestInterface public function __construct() { $this->middlewares = \config('request.middlewares', []); - $this->exception = \config('request.exception', ExceptionHandlerDispatcher::class); + $this->exception = \config('request.exception', ExceptionHandlerDispatcher::class); } @@ -310,6 +310,19 @@ class Request implements ServerRequestInterface return $this->__call__(__FUNCTION__, $name); } + + /** + * @return array + */ + public function all(): array + { + $data = $this->getParsedBody(); + if (is_array($data)) { + return $data; + } + return []; + } + /** * Gets the body of the message. *