| 21 | } |
| 22 | |
| 23 | void 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 | |
| 40 | AbstractProtocolHandler &RpcProtocolServer12::GetHandler(const Json::Value &request) { |
| 41 | if (request.isArray() || (request.isObject() && request.isMember("jsonrpc") && request["jsonrpc"].asString() == "2.0")) |
no test coverage detected