diff --git a/src/JsonResponse.php b/src/JsonResponse.php index 639ce55..a345ef1 100644 --- a/src/JsonResponse.php +++ b/src/JsonResponse.php @@ -65,7 +65,6 @@ class JsonResponse implements JsonSerializable 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, DELETE, PUT, PATCH', 'Access-Control-Max-Age' => '86400' ], $headers); - $this->preparedOutput = ''; } /** @@ -161,6 +160,9 @@ class JsonResponse implements JsonSerializable protected function preparedOutput(): JsonResponse { try { + if (!empty($GLOBALS['errorMessages'])){ + $this->mergeInContent(['errorMessages'=>$GLOBALS['errorMessages']]); + } json_encode($this->content); } catch (Throwable $th) { $this->code = 500;