Client API: add error on unknown action

This commit is contained in:
Bartek Fabiszewski 2017-08-24 11:05:36 +02:00
parent 1513ff53a3
commit 18fa942259

View File

@ -65,7 +65,7 @@ switch ($action) {
case "addtrack":
$trackName = isset($_REQUEST['track']) ? $_REQUEST['track'] : NULL;
if (empty($trackName)) {
setError($response, "missing required parameter");
setError($response, "Missing required parameter");
break;
}
require_once(ROOT_DIR . "/helpers/track.php");
@ -93,7 +93,7 @@ switch ($action) {
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
if (is_null($lat) || is_null($lon) || is_null($timestamp) || is_null($trackId)) {
setError($response, "missing required parameter");
setError($response, "Missing required parameter");
break;
}
@ -105,6 +105,10 @@ switch ($action) {
setError($response, "Server error");
}
break;
default:
setError($response, "Unknown command");
break;
}
header('Content-Type: application/json');