diff --git a/src/server/main_service.cc b/src/server/main_service.cc index d8f4c6eb0..938bde4bf 100644 --- a/src/server/main_service.cc +++ b/src/server/main_service.cc @@ -2450,7 +2450,7 @@ void Service::Command(CmdArgList args, Transaction* tx, SinkReplyBuilder* builde return builder->SendLong(cmd_cnt); } - const bool sufficient_args = (args.size() == 2); + bool sufficient_args = (args.size() == 2); // INFO [cmd] if (subcmd == "INFO" && sufficient_args) { @@ -2466,6 +2466,7 @@ void Service::Command(CmdArgList args, Transaction* tx, SinkReplyBuilder* builde return; } + sufficient_args = (args.size() == 1); if (subcmd == "DOCS" && sufficient_args) { return builder->SendOk(); } diff --git a/src/server/server_family_test.cc b/src/server/server_family_test.cc index abeb5317f..accdfc870 100644 --- a/src/server/server_family_test.cc +++ b/src/server/server_family_test.cc @@ -545,4 +545,8 @@ TEST_F(ServerFamilyTest, ConfigNormalization) { RespArray(ElementsAre("replica_priority", "13"))); } +TEST_F(ServerFamilyTest, CommandDocsOk) { + EXPECT_THAT(Run({"command", "docs"}), "OK"); +} + } // namespace dfly