Changeset View
Changeset View
Standalone View
Standalone View
src/rest.cpp
Show First 20 Lines • Show All 340 Lines • ▼ Show 20 Lines | static bool rest_chaininfo(Config &config, const util::Ref &context, | ||||
std::string param; | std::string param; | ||||
const RetFormat rf = ParseDataFormat(param, strURIPart); | const RetFormat rf = ParseDataFormat(param, strURIPart); | ||||
switch (rf) { | switch (rf) { | ||||
case RetFormat::JSON: { | case RetFormat::JSON: { | ||||
JSONRPCRequest jsonRequest(context); | JSONRPCRequest jsonRequest(context); | ||||
jsonRequest.params = UniValue(UniValue::VARR); | jsonRequest.params = UniValue(UniValue::VARR); | ||||
UniValue chainInfoObject = getblockchaininfo(config, jsonRequest); | UniValue chainInfoObject = | ||||
getblockchaininfo().HandleRequest(config, jsonRequest); | |||||
std::string strJSON = chainInfoObject.write() + "\n"; | std::string strJSON = chainInfoObject.write() + "\n"; | ||||
req->WriteHeader("Content-Type", "application/json"); | req->WriteHeader("Content-Type", "application/json"); | ||||
req->WriteReply(HTTP_OK, strJSON); | req->WriteReply(HTTP_OK, strJSON); | ||||
return true; | return true; | ||||
} | } | ||||
default: { | default: { | ||||
return RESTERR(req, HTTP_NOT_FOUND, | return RESTERR(req, HTTP_NOT_FOUND, | ||||
"output format not found (available: json)"); | "output format not found (available: json)"); | ||||
▲ Show 20 Lines • Show All 445 Lines • Show Last 20 Lines |