aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Halle <niklas@niklashalle.net>2020-08-23 15:10:16 +0200
committerNiklas Halle <niklas@niklashalle.net>2020-08-23 15:12:06 +0200
commit6d51498a3630b904b7298cbe13b05de8cc12e5ad (patch)
tree57540cad5e8428eeabc5fb0068251ee9dfa12d87
parent851882f9552b5a697fc1ed141f89f9f7caa7349a (diff)
downloadn_core-6d51498a3630b904b7298cbe13b05de8cc12e5ad.tar.gz
n_core-6d51498a3630b904b7298cbe13b05de8cc12e5ad.zip
error on missing command field
-rw-r--r--src/main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 58d5791..daa9a09 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -42,6 +42,9 @@ int main() {
if (!data)
return crow::response(400);
+ if (!data.count("command"))
+ return crow::response(400, "malformed request: missing `command` field\n");
+
std::string command = (data.count("command") ? data["command"].s() : NO_SUCH_COMMAND);
std::string arguments = (data.count("arguments") ? data["arguments"].s() : EMPTY_STRING);
std::string session = (data.count("session") ? data["session"].s() : NULL_STRING);