Fix the input argument parsing for sysadm-server.

This commit is contained in:
Ken Moore
2016-01-04 13:01:39 -05:00
parent 467e7d2bbe
commit 87ab5f2a22
2 changed files with 7 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ public:
HTTPVERSION = CurHttpVersion; //default value
if(message.isEmpty()){ return; }
//Pull out any REST headers
Body = message;
if(!message.startsWith("{")){
Header = message.section("\n{",0,0).split("\n");
}
@@ -56,7 +57,7 @@ public:
//Valid JSON found
if(doc.object().contains("namespace") ){ namesp = doc.object().value("namespace").toString(); }
if(doc.object().contains("name") ){ name = doc.object().value("name").toString(); }
if(doc.object().contains("id") ){ namesp = doc.object().value("id").toString(); }
if(doc.object().contains("id") ){ id = doc.object().value("id").toString(); }
if(doc.object().contains("args") ){ args = doc.object().value("args"); }
else{
//no args structure - treat the entire body as the arguments struct

View File

@@ -75,6 +75,11 @@ void WebSocket::EvaluateREST(QString msg){
qDebug() << " VERB:" << IN.VERB << "URI:" << IN.URI;
qDebug() << " HEADERS:" << IN.Header;
qDebug() << " BODY:" << IN.Body;
qDebug() << "JSON Values:";
qDebug() << " - Name:" << IN.name;
qDebug() << " - Namespace:" << IN.namesp;
qDebug() << " - ID:" << IN.id;
qDebug() << " - Has Args:" << IN.args.isNull();
}
//Now check for the REST-specific verbs/actions
if(IN.VERB == "OPTIONS" || IN.VERB == "HEAD"){