mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 19:56:00 +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")
|
||||
return {};
|
||||
|
||||
if (!request.contains("params") || !request.at("params").is_array())
|
||||
if (!request.at("params").is_array())
|
||||
return {};
|
||||
|
||||
boost::json::array const& array = request.at("params").as_array();
|
||||
|
||||
@@ -111,6 +111,9 @@ handle_request(
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user