summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/server')
-rw-r--r--src/uscxml/server/HTTPServer.cpp5
-rw-r--r--src/uscxml/server/HTTPServer.h7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index bbcbd37..48d2f96 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -408,7 +408,10 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
}
request.data.compound["content"].atom.clear();
} else if (iequals(contentType.substr(0, 16), "application/json")) {
- request.data.compound["content"] = Data::fromJSON(request.data.compound["content"].atom);
+ Data json = Data::fromJSON(request.data.compound["content"].atom);
+ if (!json.empty()) {
+ request.data.compound["content"] = json;
+ }
} else if (iequals(contentType.substr(0, 15), "application/xml")) {
NameSpacingParser parser = NameSpacingParser::fromXML(request.data.compound["content"].atom);
if (parser.errorsReported()) {
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
index b1816bc..dc9af53 100644
--- a/src/uscxml/server/HTTPServer.h
+++ b/src/uscxml/server/HTTPServer.h
@@ -71,7 +71,14 @@ public:
class Reply {
public:
+ Reply() : status(200), type("get"), evhttpReq(NULL) {}
Reply(Request req) : status(200), type(req.data.compound["type"].atom), evhttpReq(req.evhttpReq) {}
+
+ void setRequest(Request req) {
+ type = req.data.compound["type"].atom;
+ evhttpReq = req.evhttpReq;
+ }
+
int status;
std::string type;
std::map<std::string, std::string> headers;