diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-09-29 18:48:27 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2016-10-19 14:30:14 +0200 |
commit | 23c32a9694e119f957c124f4501294ae7a5fd99a (patch) | |
tree | 37d8d20f815136a82d7e97cb3b8e77d14d42aa38 | |
parent | d736a6eb1f91ba88059ff41634bd4ea715d9a1f1 (diff) |
rpc: Change JSONRPCRequest to JSONRPCRequestObj
This is more consistent with `JSONRPCReplyObj`.
-rw-r--r-- | src/bitcoin-cli.cpp | 2 | ||||
-rw-r--r-- | src/rpc/protocol.cpp | 4 | ||||
-rw-r--r-- | src/rpc/protocol.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 9d4c4e53bd..2d66448d80 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -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()); // 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); assert(output_buffer); evbuffer_add(output_buffer, strRequest.data(), strRequest.size()); diff --git a/src/rpc/protocol.cpp b/src/rpc/protocol.cpp index bb885bb5a6..ec186f4fc5 100644 --- a/src/rpc/protocol.cpp +++ b/src/rpc/protocol.cpp @@ -26,13 +26,13 @@ using namespace std; * 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); request.push_back(Pair("method", strMethod)); request.push_back(Pair("params", params)); request.push_back(Pair("id", id)); - return request.write() + "\n"; + return request; } UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id) diff --git a/src/rpc/protocol.h b/src/rpc/protocol.h index 1d2ef0e41e..c74fa0070f 100644 --- a/src/rpc/protocol.h +++ b/src/rpc/protocol.h @@ -77,7 +77,7 @@ enum RPCErrorCode 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); std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id); UniValue JSONRPCError(int code, const std::string& message); |