Commit 3814aaac by amir

fix WriteObjectToResponse of MsgArchiver to construct BaseRestResponse

parent e3256b61
Showing with 9 additions and 3 deletions
## C++ Microservice Framework ## C++ Microservice Framework
## VERSIONS: ## VERSIONS:
# 1.4.1
- add nlohman json to write/read response/request
# 1.4.0 # 1.4.0
- Add colorful logging - Add colorful logging
# 1.3.0 # 1.3.0
......
...@@ -396,9 +396,13 @@ namespace nsMicroservice_Iface ...@@ -396,9 +396,13 @@ namespace nsMicroservice_Iface
template <typename Msg> template <typename Msg>
void WriteObjectToResponse(nsMicroservice_Iface::IResponse* pti_Response,IMsgArchiver<Msg>& archiver, Msg& inMsg){ void WriteObjectToResponse(nsMicroservice_Iface::IResponse* pti_Response,IMsgArchiver<Msg>& archiver, Msg& inMsg){
std::string outStr; std::string outStr;
if (archiver.build(inMsg,outStr).IsSuccess()){ std::ostringstream c_OutputStream;
pti_Response->Send(outStr.c_str()); if (archiver.build(inMsg,outStr).IsSuccess()){
} c_OutputStream << nsMicroservice_Constants::SUCCESS_REST_RESPONSE_TEMPLATE << outStr.c_str() << '}';
} else {
c_OutputStream << nsMicroservice_Constants::SUCCESS_NULL_REST_RESPONSE_TEMPLATE << '}';
}
pti_Response->Send(c_OutputStream.str().c_str());
} }
////////// PUB/SUB //////////////////////////////// ////////// PUB/SUB ////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment