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

Method HandleRequest

src/jsonrpccpp/server/rpcprotocolserver12.cpp:23–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void RpcProtocolServer12::HandleRequest(const std::string &request, std::string &retValue) {
24 Json::Value req;
25 Json::Value resp;
26 Json::StreamWriterBuilder wbuilder;
27 wbuilder["indentation"] = "";
28
29 try {
30 istringstream(request) >> req;
31 this->GetHandler(req).HandleJsonRequest(req, resp);
32 } catch (const Json::Exception &e) {
33 this->GetHandler(req).WrapError(Json::nullValue, Errors::ERROR_RPC_JSON_PARSE_ERROR, Errors::GetErrorMessage(Errors::ERROR_RPC_JSON_PARSE_ERROR), resp);
34 }
35
36 if (resp != Json::nullValue)
37 retValue = Json::writeString(wbuilder, resp);
38}
39
40AbstractProtocolHandler &RpcProtocolServer12::GetHandler(const Json::Value &request) {
41 if (request.isArray() || (request.isObject() && request.isMember("jsonrpc") && request["jsonrpc"].asString() == "2.0"))

Callers 2

ProcessRequestMethod · 0.45
callbackMethod · 0.45

Calls 3

HandleJsonRequestMethod · 0.45
GetHandlerMethod · 0.45
WrapErrorMethod · 0.45

Tested by

no test coverage detected