1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-03 18:04:08 +02:00

add basic api tests

This commit is contained in:
Robin Appelman 2017-07-16 01:12:07 +02:00
commit e00e6ece5f
30 changed files with 350 additions and 17 deletions

View file

@ -16,10 +16,19 @@ class UploadController extends BaseController {
$blu = $this->post('blu', 'BLU');
$name = $this->post('name', 'Unnamed');
$demo = $this->file('demo');
if (is_null($demo)) {
echo 'No demo uploaded';
return;
}
$demoFile = $demo['tmp_name'];
try {
echo $this->uploadProvider->upload($key, $red, $blu, $name, $demoFile);
$result = $this->uploadProvider->upload($key, $red, $blu, $name, $demoFile);
if ($result === 'Invalid key') {
\Flight::response()->status(401)->write($result)->send();
} else {
echo $result;
}
} catch (\Exception $e) {
\Flight::response()
->status(500)