diff --git a/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp b/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp index f82492df28..c9bef7f05f 100644 --- a/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp +++ b/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp @@ -67,7 +67,7 @@ namespace eosio { namespace rest { try { auto res = self()->on_request(std::move(req)); if (!res) - not_found(target); + return not_found(target); return *res; } catch (std::exception& ex) { return server_error(ex.what()); } } diff --git a/tests/TestHarness/queries.py b/tests/TestHarness/queries.py index e73c3ad06b..5521be8870 100644 --- a/tests/TestHarness/queries.py +++ b/tests/TestHarness/queries.py @@ -643,6 +643,8 @@ def processUrllibRequest(self, resource, command, payload={}, silentErrors=False rtn = ex.read() else: unhandledEnumType(returnType) + elif returnType==ReturnType.raw: + return ex.code else: return None diff --git a/tests/plugin_http_api_test.py b/tests/plugin_http_api_test.py index b020039817..c0fc0cb2ba 100755 --- a/tests/plugin_http_api_test.py +++ b/tests/plugin_http_api_test.py @@ -1352,6 +1352,8 @@ def test_prometheusApi(self) : self.assertTrue(int(metrics["blocks_produced"]) > 1) self.assertTrue(int(metrics["last_irreversible"]) > 1) + ret = self.nodeos.processUrllibRequest(resource, "m", returnType = ReturnType.raw, method="GET", silentErrors= True, endpoint=endpointPrometheus) + self.assertTrue(ret == 404) def test_multipleRequests(self): """Test keep-alive ability of HTTP plugin. Handle multiple requests in a single session"""