This commit is contained in:
2023-10-18 10:58:24 +08:00
parent 8c4ba1ae99
commit f621513587
+3 -3
View File
@@ -132,9 +132,9 @@ class OnRequest implements OnRequestInterface
->withQueryParams($request->get ?? []) ->withQueryParams($request->get ?? [])
->withParsedBody(function () use ($request) { ->withParsedBody(function () use ($request) {
$contentType = $request->header['content-type'] ?? 'application/json'; $contentType = $request->header['content-type'] ?? 'application/json';
if (str_contains($contentType, 'json')) { if (\str_contains($contentType, 'json')) {
return Json::decode($request->getContent()); return \json_decode($request->getContent(),true);
} else if (str_contains($contentType, 'xml')) { } else if (\str_contains($contentType, 'xml')) {
return Xml::toArray($request->getContent()); return Xml::toArray($request->getContent());
} else { } else {
return $request->post ?? []; return $request->post ?? [];