mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-21 04:05:51 +00:00
Handle case where params is null (#65)
* if request does not have parameters, set params to empty [{}]
This commit is contained in:
@@ -37,7 +37,7 @@ make_HttpContext(
|
|||||||
if (command == "subscribe" || command == "unsubscribe")
|
if (command == "subscribe" || command == "unsubscribe")
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (!request.contains("params") || !request.at("params").is_array())
|
if (!request.at("params").is_array())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
boost::json::array const& array = request.at("params").as_array();
|
boost::json::array const& array = request.at("params").as_array();
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ handle_request(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
request = boost::json::parse(req.body()).as_object();
|
request = boost::json::parse(req.body()).as_object();
|
||||||
|
|
||||||
|
if (!request.contains("params"))
|
||||||
|
request["params"] = boost::json::array({ boost::json::object {} });
|
||||||
}
|
}
|
||||||
catch (std::runtime_error const& e)
|
catch (std::runtime_error const& e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user