aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-10-02 15:06:18 +0800
committerfanquake <fanquake@gmail.com>2020-10-02 15:25:20 +0800
commit60ec57b3d73e5cef71ebf3c4cdf54a4474bf492b (patch)
tree3745f51247328903f435584f9b731ffbdce9df47
parenta6a993a888f578fcb8d6ff60ce0265fad55dafcb (diff)
parent7eab781a145a35d0373c4ab4d237a82b4919e88d (diff)
downloadbitcoin-60ec57b3d73e5cef71ebf3c4cdf54a4474bf492b.tar.xz
Merge #20055: rpc: Set HTTP Content-Type in bitcoin-cli
7eab781a145a35d0373c4ab4d237a82b4919e88d rpc: Set HTTP Content-Type in bitcoin-cli (Wladimir J. van der Laan) Pull request description: We don't set any `Content-Type` in the client. It is more consistent with our other JSON-RPC use to set it to `application/json`. Note that our server doesn't enforce content types, so it doesn't make a difference in practice. But it is fairly strange HTTP behavior to not set it at all for a POST request. This came up in #18950. ACKs for top commit: promag: ACK 7eab781a145a35d0373c4ab4d237a82b4919e88d. jonatack: Tested ACK 7eab781a145a35d0373c4ab4d237a82b4919e88d practicalswift: ACK 7eab781a145a35d0373c4ab4d237a82b4919e88d: patch looks correct fanquake: ACK 7eab781a145a35d0373c4ab4d237a82b4919e88d - Looks fine to me. Tree-SHA512: a9fa155324d0f7bff955585a336ead6bb60b721039f424521a435e4bb0fad3f4532e5cc7b7a9acc4e93585e8d3db3082c010138810f22c0e92b8f749b86ef653
-rw-r--r--src/bitcoin-cli.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index aec4177b19..28394e7041 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -596,6 +596,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
assert(output_headers);
evhttp_add_header(output_headers, "Host", host.c_str());
evhttp_add_header(output_headers, "Connection", "close");
+ evhttp_add_header(output_headers, "Content-Type", "application/json");
evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str());
// Attach request data