diff options
Diffstat (limited to 'src/uscxml/plugins/element/respond/RespondElement.cpp')
-rw-r--r-- | src/uscxml/plugins/element/respond/RespondElement.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/uscxml/plugins/element/respond/RespondElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp index 21d5907..2b8d02d 100644 --- a/src/uscxml/plugins/element/respond/RespondElement.cpp +++ b/src/uscxml/plugins/element/respond/RespondElement.cpp @@ -85,10 +85,18 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) { Data contentData = _interpreter->getDataModel().getStringAsData(ATTR(contents[0], "expr")); if (contentData.atom.length() > 0) { httpReply.content = contentData.atom; + httpReply.headers["Content-Type"] = "text/plain"; } else if (contentData.binary) { httpReply.content = std::string(contentData.binary->data, contentData.binary->size); + httpReply.headers["Content-Type"] = contentData.binary->mimeType; + } else if (contentData.node) { + std::stringstream ss; + ss << contentData.node; + httpReply.content = ss.str();; + httpReply.headers["Content-Type"] = "application/xml"; } else { httpReply.content = Data::toJSON(contentData); + httpReply.headers["Content-Type"] = "application/json"; } } catch (Event e) { LOG(ERROR) << "Syntax error with expr in content child of Respond element:" << std::endl << e << std::endl; |