fix: parse JSON body in log report endpoint
This commit is contained in:
@@ -11,7 +11,8 @@ class Log
|
||||
public function report(): Json
|
||||
{
|
||||
if (!Request::instance()->isPost()) return json(['status' => 0]);
|
||||
$data = Request::instance()->post();
|
||||
$raw = file_get_contents('php://input');
|
||||
$data = json_decode($raw, true) ?: Request::instance()->post();
|
||||
\app\utils\Logger::error(\app\utils\Logger::CAT_FRONTEND, $data['message'] ?? 'unknown', [
|
||||
'source' => $data['source'] ?? 'unknown',
|
||||
'type' => $data['type'] ?? 'error',
|
||||
|
||||
@@ -11,7 +11,8 @@ class Log
|
||||
public function report(): Json
|
||||
{
|
||||
if (!Request::instance()->isPost()) return json(['status' => 0]);
|
||||
$data = Request::instance()->post();
|
||||
$raw = file_get_contents('php://input');
|
||||
$data = json_decode($raw, true) ?: Request::instance()->post();
|
||||
\app\utils\Logger::error(\app\utils\Logger::CAT_FRONTEND, $data['message'] ?? 'unknown', [
|
||||
'source' => $data['source'] ?? 'unknown',
|
||||
'type' => $data['type'] ?? 'error',
|
||||
|
||||
Reference in New Issue
Block a user