From 1540f2685675e6f7fac1ae7fe35e0c6482045a54 Mon Sep 17 00:00:00 2001 From: xl Date: Mon, 13 Nov 2023 22:37:48 +0800 Subject: [PATCH] eee --- Handler/OnRequest.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Handler/OnRequest.php b/Handler/OnRequest.php index 0e25a9c..cec2f7d 100644 --- a/Handler/OnRequest.php +++ b/Handler/OnRequest.php @@ -6,6 +6,7 @@ namespace Kiri\Server\Handler; use Exception; use Kiri; +use Kiri\Router\Constrict\Stream; use Kiri\Core\Xml; use Kiri\Di\Inject\Container; use Kiri\Di\Context; @@ -125,16 +126,8 @@ class OnRequest implements OnRequestInterface ->withCookieParams($request->cookie ?? []) ->withServerParams($request->server) ->withQueryParams($request->get ?? []) - ->withParsedBody(function () use ($request) { - $contentType = $request->header['content-type'] ?? 'application/json'; - if (\str_contains($contentType, 'json')) { - return \json_decode($request->getContent(), true); - } else if (\str_contains($contentType, 'xml')) { - return Xml::toArray($request->getContent()); - } else { - return $request->post ?? []; - } - }) + ->withBody(new Stream($request->getContent())) + ->withParsedBody($request) ->withUploadedFiles($request->files ?? []) ->withMethod($request->getMethod()); }