Improved error message on mistyped command [RIPD-1527]:

Previously if you mistyped the "submit_multisigned" command as
"submit_multisign", the returned message was "Internal error".  Not
very helpful.  It turns out this was caused by a small amount of
code in RPCCall.cpp.  Removing that code improves two situations:

1. It improves the situation with a mistyped command.  Now the
   command returns "Unknown method" and provides the string of
   the mistyped command.

2. The "transaction_entry", if properly entered in its command
   line form, would fire an assert.  That assert is now removed.

In the process, it was discovered that the command line form of
the "transaction_entry" command has not worked correctly for at
least a year.  Therefore support for that the command line form
of "transaction_entry" is added along with appropriate unit
tests.
This commit is contained in:
Scott Schurr
2017-11-22 18:39:08 -08:00
committed by seelabs
parent 8a02b76d73
commit 722917e9a6
3 changed files with 139 additions and 19 deletions

View File

@@ -1840,6 +1840,17 @@ R"({
class JSONRPC_test : public beast::unit_test::suite
{
public:
void testBadRpcCommand ()
{
test::jtx::Env env(*this);
Json::Value const result {
env.rpc ("bad_command", R"({"MakingThisUp": 0})")};
BEAST_EXPECT (result[jss::result][jss::error] == "unknownCmd");
BEAST_EXPECT (
result[jss::result][jss::request][jss::command] == "bad_command");
}
void testAutoFillFees ()
{
test::jtx::Env env(*this);
@@ -2345,6 +2356,7 @@ public:
void run ()
{
testBadRpcCommand ();
testAutoFillFees ();
testAutoFillEscalatedFees ();
testTransactionRPC ();