Skip to content

Commit 68a9591

Browse files
authored
Merge pull request #1197 from AntelopeIO/merge_get_info_category_fix
[1.1.1 -> main] Fix get_info not available on non-chain API endpoints
2 parents 7f9438d + 2fcaffb commit 68a9591

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

plugins/chain_api_plugin/chain_api_plugin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void chain_api_plugin::plugin_startup() {
127127

128128
// Run get_info on http thread only
129129
_http_plugin.add_async_api({
130-
CHAIN_RO_CALL_WITH_400(get_info, 200, http_params_types::no_params)
130+
CALL_WITH_400(chain, node, ro_api, chain_apis::read_only, get_info, 200, http_params_types::no_params)
131131
});
132132

133133
_http_plugin.add_api({

tests/plugin_http_api_test.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,13 @@ def test_ChainApi(self) :
128128
command = "get_info"
129129
endpoint=self.endpoint("chain_ro")
130130

131-
# get_info without parameter
131+
# get_info without parameter with default chain_ro endpoint
132132
ret_json = self.nodeos.processUrllibRequest(resource, command, endpoint=endpoint)
133133
self.assertIn("server_version", ret_json["payload"])
134+
# get_info without parameter with an endpoint (catelog) other than chain_ro
135+
# get_info should work on any end point
136+
ret_json = self.nodeos.processUrllibRequest(resource, command, endpoint=self.endpoint("producer_ro"))
137+
self.assertIn("server_version", ret_json["payload"])
134138
# get_info with empty content parameter
135139
ret_json = self.nodeos.processUrllibRequest(resource, command, self.empty_content_dict, endpoint=endpoint)
136140
self.assertIn("server_version", ret_json["payload"])
@@ -1637,7 +1641,12 @@ def tearDownClass(self):
16371641
sys.argv[1:] = args.unittest_args
16381642
suite = unittest.TestLoader().loadTestsFromTestCase(PluginHttpTest)
16391643
results = unittest.TextTestRunner().run(suite)
1644+
testSuccessful = True
16401645
if not results.wasSuccessful():
16411646
keepLogs = True
1647+
testSuccessful = False
16421648
if not keepLogs:
16431649
PluginHttpTest().cleanEnv()
1650+
1651+
exitCode = 0 if testSuccessful else 1
1652+
exit(exitCode)

0 commit comments

Comments
 (0)