Skip to content

Commit 7eab781

Browse files
committed
rpc: Set HTTP Content-Type in bitcoin-cli
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. This came up in #18950.
1 parent 3487e42 commit 7eab781

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/bitcoin-cli.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
596596
assert(output_headers);
597597
evhttp_add_header(output_headers, "Host", host.c_str());
598598
evhttp_add_header(output_headers, "Connection", "close");
599+
evhttp_add_header(output_headers, "Content-Type", "application/json");
599600
evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str());
600601

601602
// Attach request data

0 commit comments

Comments
 (0)