Commit fb101b93 by Amir Aharon

1.5.3 fix GetContent

parent cbac5752
......@@ -3,7 +3,7 @@ project(Microservice)
# version stuff
set (Microservice_VERSION_MAJOR 1)
set (Microservice_VERSION_MINOR 5)
set (Microservice_VERSION_PATCH 2)
set (Microservice_VERSION_PATCH 3)
set(Microservice_VERSION_STRING ${Microservice_VERSION_MAJOR}.${Microservice_VERSION_MINOR}.${Microservice_VERSION_PATCH})
# type build flags
......
## C++ Microservice Framework
* to create microservice docker run script/build_microservice_docker.sh [version]
## VERSIONS:
# 1.5.3
- fix for IRequest->GetContent() in Evpp
# 1.5.2
- Fix for sigegv
- testing http client performance
......
......@@ -59,6 +59,7 @@ class Microservice_IRequestRestEvppImpl: public nsMicroservice_Iface::IRequest {
public:
Microservice_IRequestRestEvppImpl(EvppConnParams connParams): connParams_(connParams) {
queryString_ = ParseQueryString();
body_ = connParams_.ctx_->body().ToString();
}
const char *ParseQueryString() {
......@@ -82,10 +83,16 @@ public:
return connParams_.ctx_->uri().c_str();
}
/**
* @brief Get the Content object
* note that the body is a reference to a reusable buffer
* so we need to take into account the actual size
* @return const char*
*/
const char *GetContent() override {
// if (p_restMsg_)
// return p_restMsg_->content()->c_str();
return connParams_.ctx_->body().data();
return body_.size() ? body_.c_str() : nullptr;
}
void Reset() override {
......@@ -98,6 +105,7 @@ public:
private:
EvppConnParams connParams_;
const char* queryString_;
std::string body_;
char buff_[nsMicroservice_Constants::MAX_URI_LENGTH];
};
......
......@@ -82,15 +82,16 @@ public:
// CreateSync(pc_reqCtx);
}
else {
MsgArchiverJsonLohmann archiverJsonLohmann;
nlohmann::json outMsg;
if (this->ReadObjectFromRequest<>(pc_reqCtx,archiverJsonLohmann,outMsg))
this->WriteObjectToResponse<>(pc_reqCtx,archiverJsonLohmann,outMsg);
// rapidjson::Document rpj_Doc;
// if (this->ReadObjectFromRequest(pc_reqCtx,rpj_Doc) )
// this->WriteObjectToResponse(pc_reqCtx,rpj_Doc);
// else
// this->SendErrorResp(pc_reqCtx,"Error in parsing json");
// MsgArchiverJsonLohmann archiverJsonLohmann;
// nlohmann::json outMsg;
// if (this->ReadObjectFromRequest<>(pc_reqCtx,archiverJsonLohmann,outMsg))
// this->WriteObjectToResponse<>(pc_reqCtx,archiverJsonLohmann,outMsg);
// else
rapidjson::Document rpj_Doc;
if (this->ReadObjectFromRequest(pc_reqCtx,rpj_Doc) )
this->WriteObjectToResponse(pc_reqCtx,rpj_Doc);
else
this->SendErrorResp(pc_reqCtx,"Error in parsing json");
}
}
......
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