Client API: add error on unknown action
This commit is contained in:
parent
1513ff53a3
commit
18fa942259
@ -65,7 +65,7 @@ switch ($action) {
|
|||||||
case "addtrack":
|
case "addtrack":
|
||||||
$trackName = isset($_REQUEST['track']) ? $_REQUEST['track'] : NULL;
|
$trackName = isset($_REQUEST['track']) ? $_REQUEST['track'] : NULL;
|
||||||
if (empty($trackName)) {
|
if (empty($trackName)) {
|
||||||
setError($response, "missing required parameter");
|
setError($response, "Missing required parameter");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
require_once(ROOT_DIR . "/helpers/track.php");
|
require_once(ROOT_DIR . "/helpers/track.php");
|
||||||
@ -93,7 +93,7 @@ switch ($action) {
|
|||||||
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
|
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
|
||||||
|
|
||||||
if (is_null($lat) || is_null($lon) || is_null($timestamp) || is_null($trackId)) {
|
if (is_null($lat) || is_null($lon) || is_null($timestamp) || is_null($trackId)) {
|
||||||
setError($response, "missing required parameter");
|
setError($response, "Missing required parameter");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,11 @@ switch ($action) {
|
|||||||
setError($response, "Server error");
|
setError($response, "Server error");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
default:
|
||||||
|
setError($response, "Unknown command");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user