Commit 3814aaac by amir

fix WriteObjectToResponse of MsgArchiver to construct BaseRestResponse

parent e3256b61
Showing with 7 additions and 1 deletions
## C++ Microservice Framework
## VERSIONS:
# 1.4.1
- add nlohman json to write/read response/request
# 1.4.0
- Add colorful logging
# 1.3.0
......
......@@ -396,9 +396,13 @@ namespace nsMicroservice_Iface
template <typename Msg>
void WriteObjectToResponse(nsMicroservice_Iface::IResponse* pti_Response,IMsgArchiver<Msg>& archiver, Msg& inMsg){
std::string outStr;
std::ostringstream c_OutputStream;
if (archiver.build(inMsg,outStr).IsSuccess()){
pti_Response->Send(outStr.c_str());
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 ////////////////////////////////
......
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