Skip to content

Commit

Permalink
Serialize data as JSON with Accept: application/json
Browse files Browse the repository at this point in the history
Similar to NixOS#607. According to the Catalyst[1] docs it's possible to
specify a data structure that is supposed to be serialized when
requesting i.e. a JSON response.

[1] https://metacpan.org/pod/Catalyst::Controller::REST#status_ok
  • Loading branch information
Ma27 committed Feb 14, 2019
1 parent b298ba4 commit 1cbbc6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/Hydra/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ sub machines :Local Args(0) {
"where busy != 0 order by machine, stepnr",
{ Slice => {} });
$c->stash->{template} = 'machine-status.tt';
$self->status_ok($c, entity => $c->stash->{machines});
}


Expand Down Expand Up @@ -344,7 +345,9 @@ sub evals :Local Args(0) {
$c->stash->{page} = $page;
$c->stash->{resultsPerPage} = $resultsPerPage;
$c->stash->{total} = $evals->search({hasnewbuilds => 1})->count;
$c->stash->{evals} = getEvals($self, $c, $evals, ($page - 1) * $resultsPerPage, $resultsPerPage)
$c->stash->{evals} = getEvals($self, $c, $evals, ($page - 1) * $resultsPerPage, $resultsPerPage);

$self->status_ok($c, entity => $c->stash->{evals});
}


Expand Down

0 comments on commit 1cbbc6c

Please sign in to comment.