mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Cleanup some Json::Value methods:
* Rename isArray to isArrayOrNull * Rename isObject to isObjectOrNull * Introduce isArray and isObject * Change as many uses of isArrayorNull to isArray as possible * Change as many uses of isObjectorNull to isObject as possible * Reject null JSON arrays for subscribe and unsubscribe
This commit is contained in:
committed by
Mike Ellery
parent
20defb4844
commit
1a245234f1
@@ -334,7 +334,6 @@ ServerHandlerImp::onWSMessage(
|
||||
auto const size = boost::asio::buffer_size(buffers);
|
||||
if (size > RPC::Tuning::maxRequestSize ||
|
||||
! Json::Reader{}.parse(jv, buffers) ||
|
||||
! jv ||
|
||||
! jv.isObject())
|
||||
{
|
||||
Json::Value jvResult(Json::objectValue);
|
||||
@@ -603,7 +602,7 @@ ServerHandlerImp::processRequest (Port const& port,
|
||||
if (jsonRPC.isMember(jss::params) &&
|
||||
jsonRPC[jss::params].isArray() &&
|
||||
jsonRPC[jss::params].size() > 0 &&
|
||||
jsonRPC[jss::params][Json::UInt(0)].isObject())
|
||||
jsonRPC[jss::params][Json::UInt(0)].isObjectOrNull())
|
||||
{
|
||||
role = requestRole(
|
||||
required,
|
||||
@@ -712,7 +711,7 @@ ServerHandlerImp::processRequest (Port const& port,
|
||||
if (! params)
|
||||
params = Json::Value (Json::objectValue);
|
||||
|
||||
else if (!params.isArray () || params.size() != 1)
|
||||
else if (!params.isArray() || params.size() != 1)
|
||||
{
|
||||
usage.charge(Resource::feeInvalidRPC);
|
||||
HTTPReply (400, "params unparseable", output, rpcJ);
|
||||
@@ -721,7 +720,7 @@ ServerHandlerImp::processRequest (Port const& port,
|
||||
else
|
||||
{
|
||||
params = std::move (params[0u]);
|
||||
if (!params.isObject())
|
||||
if (!params.isObjectOrNull())
|
||||
{
|
||||
usage.charge(Resource::feeInvalidRPC);
|
||||
HTTPReply (400, "params unparseable", output, rpcJ);
|
||||
|
||||
Reference in New Issue
Block a user