mirror of
https://github.com/flarum/core.git
synced 2025-07-12 04:16:24 +02:00
@ -23,6 +23,10 @@ class ReadJsonParameters implements MiddlewareInterface
|
|||||||
{
|
{
|
||||||
if (str_contains($request->getHeaderLine('content-type'), 'json')) {
|
if (str_contains($request->getHeaderLine('content-type'), 'json')) {
|
||||||
$input = json_decode($request->getBody(), true);
|
$input = json_decode($request->getBody(), true);
|
||||||
|
|
||||||
|
if (! is_array($input)) {
|
||||||
|
$input = [];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($input as $name => $value) {
|
foreach ($input as $name => $value) {
|
||||||
$request = $request->withAttribute($name, $value);
|
$request = $request->withAttribute($name, $value);
|
||||||
|
Reference in New Issue
Block a user