rpc: Change JSONRPCRequest to JSONRPCRequestObj
This is more consistent with `JSONRPCReplyObj`.
This commit is contained in:
parent
d736a6eb1f
commit
23c32a9694
3 changed files with 4 additions and 4 deletions
|
@ -223,7 +223,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
|
||||||
evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str());
|
evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str());
|
||||||
|
|
||||||
// Attach request data
|
// Attach request data
|
||||||
std::string strRequest = JSONRPCRequest(strMethod, params, 1);
|
std::string strRequest = JSONRPCRequestObj(strMethod, params, 1).write() + "\n";
|
||||||
struct evbuffer * output_buffer = evhttp_request_get_output_buffer(req);
|
struct evbuffer * output_buffer = evhttp_request_get_output_buffer(req);
|
||||||
assert(output_buffer);
|
assert(output_buffer);
|
||||||
evbuffer_add(output_buffer, strRequest.data(), strRequest.size());
|
evbuffer_add(output_buffer, strRequest.data(), strRequest.size());
|
||||||
|
|
|
@ -26,13 +26,13 @@ using namespace std;
|
||||||
* 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html
|
* 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
string JSONRPCRequest(const string& strMethod, const UniValue& params, const UniValue& id)
|
UniValue JSONRPCRequestObj(const string& strMethod, const UniValue& params, const UniValue& id)
|
||||||
{
|
{
|
||||||
UniValue request(UniValue::VOBJ);
|
UniValue request(UniValue::VOBJ);
|
||||||
request.push_back(Pair("method", strMethod));
|
request.push_back(Pair("method", strMethod));
|
||||||
request.push_back(Pair("params", params));
|
request.push_back(Pair("params", params));
|
||||||
request.push_back(Pair("id", id));
|
request.push_back(Pair("id", id));
|
||||||
return request.write() + "\n";
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id)
|
UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id)
|
||||||
|
|
|
@ -77,7 +77,7 @@ enum RPCErrorCode
|
||||||
RPC_WALLET_ALREADY_UNLOCKED = -17, //!< Wallet is already unlocked
|
RPC_WALLET_ALREADY_UNLOCKED = -17, //!< Wallet is already unlocked
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string JSONRPCRequest(const std::string& strMethod, const UniValue& params, const UniValue& id);
|
UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params, const UniValue& id);
|
||||||
UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
|
UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
|
||||||
std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
|
std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
|
||||||
UniValue JSONRPCError(int code, const std::string& message);
|
UniValue JSONRPCError(int code, const std::string& message);
|
||||||
|
|
Loading…
Reference in a new issue