MCPcopy Create free account
hub / github.com/cinemast/libjson-rpc-cpp / HandleRequest

Method HandleRequest

src/jsonrpccpp/server/abstractprotocolhandler.cpp:24–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22void AbstractProtocolHandler::AddProcedure(const Procedure &procedure) { this->procedures[procedure.GetProcedureName()] = procedure; }
23
24void AbstractProtocolHandler::HandleRequest(const std::string &request, std::string &retValue) {
25 Json::Value req;
26 Json::Value resp;
27 Json::StreamWriterBuilder wbuilder;
28 wbuilder["indentation"] = "";
29
30 try {
31 istringstream(request) >> req;
32 this->HandleJsonRequest(req, resp);
33 } catch (const Json::Exception &e) {
34 this->WrapError(Json::nullValue, Errors::ERROR_RPC_JSON_PARSE_ERROR, Errors::GetErrorMessage(Errors::ERROR_RPC_JSON_PARSE_ERROR), resp);
35 }
36
37 if (resp != Json::nullValue)
38 retValue = Json::writeString(wbuilder, resp);
39}
40
41void AbstractProtocolHandler::ProcessRequest(const Json::Value &request, Json::Value &response) {
42 Procedure &method = this->procedures[request[KEY_REQUEST_METHODNAME].asString()];

Callers

nothing calls this directly

Calls 2

HandleJsonRequestMethod · 0.45
WrapErrorMethod · 0.45

Tested by

no test coverage detected