Add support for JSON listing #1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user