Changeset View
Changeset View
Standalone View
Standalone View
src/rest.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | switch (rf) { | ||||
jsonHeaders.push_back(blockheaderToJSON(tip, pindex)); | jsonHeaders.push_back(blockheaderToJSON(tip, pindex)); | ||||
} | } | ||||
std::string strJSON = jsonHeaders.write() + "\n"; | std::string strJSON = jsonHeaders.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( | ||||
"output format not found (available: .bin, .hex)"); | req, HTTP_NOT_FOUND, | ||||
"output format not found (available: .bin, .hex, .json)"); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
static bool rest_block(const Config &config, HTTPRequest *req, | static bool rest_block(const Config &config, HTTPRequest *req, | ||||
const std::string &strURIPart, bool showTxDetails) { | const std::string &strURIPart, bool showTxDetails) { | ||||
if (!CheckWarmup(req)) { | if (!CheckWarmup(req)) { | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 548 Lines • Show Last 20 Lines |