From 8391388f1f1d7550166dd3e12c9ff033fc0a1e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 11 Aug 2023 18:33:33 +0800 Subject: [PATCH] qqq --- Handler/OnRequest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Handler/OnRequest.php b/Handler/OnRequest.php index ca1b1e4..5c8d4c7 100644 --- a/Handler/OnRequest.php +++ b/Handler/OnRequest.php @@ -130,12 +130,13 @@ class OnRequest implements OnRequestInterface ->withUploadedFiles($request->files ?? []) ->withMethod($request->getMethod()); - var_dump($request->header); $contentType = $request->header['content-type'] ?? 'application/json'; - if (str_contains($contentType, 'json')) { - $serverRequest->withParsedBody(json_decode($request->post, true)); - } else if (str_contains($contentType, 'xml')) { - $serverRequest->withParsedBody(Xml::toArray($request->post)); + if ($request->getContent()) { + if (str_contains($contentType, 'json')) { + $serverRequest->withParsedBody(json_decode($request->getContent(), true)); + } else if (str_contains($contentType, 'xml')) { + $serverRequest->withParsedBody(Xml::toArray($request->getContent())); + } } else { $serverRequest->withParsedBody($request->post ?? []); }