mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 15:13:42 +08:00
parent
7c37320891
commit
efee030bf1
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user