fix: Preserve HTTP status code in Response::json and handle 401 session expiration gracefully in loadConversations
This commit is contained in:
@@ -39,9 +39,11 @@ class Response
|
||||
* @param int $code
|
||||
* @return void
|
||||
*/
|
||||
public function json($data, int $code = 200): void
|
||||
public function json($data, ?int $code = null): void
|
||||
{
|
||||
$this->setStatusCode($code);
|
||||
if ($code !== null) {
|
||||
$this->setStatusCode($code);
|
||||
}
|
||||
$this->setHeader('Content-Type', 'application/json; charset=utf-8');
|
||||
|
||||
// Setup CORS headers — restrict origin to the configured allowed domain
|
||||
|
||||
Reference in New Issue
Block a user