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