Page 1 of 1

JSON response - 503 Service Unavailable

Posted: Sun Mar 24, 2024 3:59 pm
by digital_project
When I try the following simple JSON response component (com_jsonresponse) on a Joomla 5 (Joomla! 5.0.3 / PHP 8.1.27) installation the response is rendered as expected, but the response code is 503 Service Unavaialable.

Code: Select all

<?php
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Response\JsonResponse;

echo new JsonResponse("hello world!", "It worked!");
tested with postman
POST on https://<domain>/index.php?option=com_jsonresponse&format=json
Result

{
"success": true,
"message": "It worked!",
"messages": null,
"data": "hello world!"
}

Status: 503 Service Unavailable

What is wrong with this code?