mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
Add PUT REST support, and clean up the bytes calculation for the output JSON data.
This commit is contained in:
@@ -139,7 +139,8 @@ public:
|
||||
headers << "Date: "+QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||
if(!Header.isEmpty()){ headers << Header; }
|
||||
//Now add the body of the return
|
||||
if(!Body.isEmpty()){ headers << "Content-Length: "+QString::number(Body.length()); }
|
||||
qDebug() << "Return JSON:" << Body;
|
||||
if(!Body.isEmpty()){ headers << "Content-Length: "+QString::number(Body.toUtf8().size()); } //number of bytes for the body
|
||||
headers << Body;
|
||||
return headers.join("\n");
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void WebSocket::EvaluateREST(QString msg){
|
||||
void WebSocket::EvaluateRequest(const RestInputStruct &REQ){
|
||||
RestOutputStruct out;
|
||||
out.in_struct = REQ;
|
||||
if(!REQ.VERB.isEmpty() && REQ.VERB != "GET" && REQ.VERB!="POST"){
|
||||
if(!REQ.VERB.isEmpty() && REQ.VERB != "GET" && REQ.VERB!="POST" && REQ.VERB!="PUT"){
|
||||
//Non-supported request (at the moment) - return an error message
|
||||
out.CODE = RestOutputStruct::BADREQUEST;
|
||||
}else if(out.in_struct.name.isEmpty() || out.in_struct.namesp.isEmpty() ){
|
||||
|
||||
Reference in New Issue
Block a user