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:
parent
64b0aff075
commit
e00e6ece5f
30 changed files with 350 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue