Add support for JSON listing #1

Merged
Francesco Siddi merged 7 commits from json-view into develop 2023-11-01 12:08:09 +01:00
Showing only changes of commit 8fbca889a5 - Show all commits

View File

@ -20,12 +20,12 @@ function renderDownloadResponseAsJSON($lister) {
$data = [ 'error' => 'Missing supported format version, for example v=1'];
echo json_encode( $data );
http_response_code(400);
exit;
return;
}
$builds = $lister->getBuilds();
$renderer = new BuildsRenderer($builds);
$renderer->renderJSON();
exit;
return;
}
function renderDownloadResponseAsHTML($lister) {
@ -55,6 +55,7 @@ function handleDownloadRequest() {
// Check if we are requesting a JSON formatted view.
if (isset($_GET['format']) && $_GET['format'] == 'json') {
renderDownloadResponseAsJSON($lister);
return;
}
renderDownloadResponseAsHTML($lister);