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.
pull/764/head
Wladimir J. van der Laan 4 years ago
parent 3487e421a7
commit 7eab781a14

@ -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

Loading…
Cancel
Save