Added API handler for getting a benchmark's tests
This commit is contained in:
parent
10df46be3b
commit
4a4f694831
@ -19,4 +19,14 @@ class ApiController extends Controller {
|
||||
->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
public function getBenchmarkTests(Request $request, Response $response, array $args): Response {
|
||||
$benchmark = Benchmark::where('id', $args['benchmark_id'])->first();
|
||||
|
||||
$payload = json_encode($benchmark->tests);
|
||||
|
||||
$response->getBody()->write($payload);
|
||||
return $response
|
||||
->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,4 +37,5 @@ $app->group('/reports', function(RouteCollectorProxy $group) {
|
||||
|
||||
$app->group('/api', function(RouteCollectorProxy $group) {
|
||||
$group->get('/benchmark/{benchmark_id}', '\\BitGoblin\\Colossus\\Controllers\\ApiController:getBenchmark')->setName('api.benchmark');
|
||||
$group->get('/benchmark/{benchmark_id}/tests', '\\BitGoblin\\Colossus\\Controllers\\ApiController:getBenchmarkTests')->setName('api.benchmark');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user