diff options
author | Niklas Halle <niklas@niklashalle.net> | 2020-08-23 15:10:16 +0200 |
---|---|---|
committer | Niklas Halle <niklas@niklashalle.net> | 2020-08-23 15:12:06 +0200 |
commit | 6d51498a3630b904b7298cbe13b05de8cc12e5ad (patch) | |
tree | 57540cad5e8428eeabc5fb0068251ee9dfa12d87 /src | |
parent | 851882f9552b5a697fc1ed141f89f9f7caa7349a (diff) | |
download | n_core-6d51498a3630b904b7298cbe13b05de8cc12e5ad.tar.gz n_core-6d51498a3630b904b7298cbe13b05de8cc12e5ad.zip |
error on missing command field
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 3 |
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); |