diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index c9fd94a08..649f309d3 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -579,3 +579,19 @@ void CyhookHandler::SendError(std::string error) { } Write(result); } +//----------------------------------------------------------------------------- +void CyhookHandler::SendResult(std::string _content) { + std::string result = ""; + switch (outType) { + case xml: + result = _content; + break; + case json: + result = json_out_success(_content); + break; + default: + result = _content; + break; + } + WriteLn(result); +} diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index 03147a8da..66c4fb362 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -194,6 +194,7 @@ public: void SendHTMLFooter(void); void SendOk(void); void SendError(std::string error = ""); + void SendResult(std::string _content); void SendFile(const std::string& url) {NewURL = url; status = HANDLED_SENDFILE;} void SendRedirect(const std::string& url) {httpStatus=HTTP_MOVED_TEMPORARILY; NewURL = url; status = HANDLED_REDIRECTION;} void SendRewrite(const std::string& url) {NewURL = url; status = HANDLED_REWRITE;}