diff --git a/src/node.cpp b/src/node.cpp index 00ed176ba77c16e70e2483dba151adcc292226c1..2869314e7b15657ee310ced17ec59e61fca09e0b 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -90,8 +90,11 @@ void Node::createStream(const std::string &uri, FrameID id) { } nlohmann::json Node::details() { - const std::string res = peer_->call<std::string>("node_details"); - return nlohmann::json::parse(res); + const auto res = peer_->call<std::vector<std::string>>("node_details"); + if (res.size() > 0) { + return nlohmann::json::parse(res[0]); + } + return {}; } int64_t Node::ping() { diff --git a/src/self.cpp b/src/self.cpp index bbf49bcc0fe74b9a381afeccda7591eb731aa76d..84671b0c325e656d8dbda156734601ad757e7fd3 100644 --- a/src/self.cpp +++ b/src/self.cpp @@ -173,8 +173,8 @@ void Self::onCreateStream(const std::function<void(const std::string &uri, Frame } void Self::onNodeDetails(const std::function<nlohmann::json()> &cb) { - universe_->bind("node_details", [cb]() { - return cb().dump(); + universe_->bind("node_details", [cb]() -> std::vector<std::string> { + return {cb().dump()}; }); } diff --git a/test/webservice_e2e.cpp b/test/webservice_e2e.cpp index 722b2813382691c807c2d9d8d8c8829df2908f96..a18abd0d2e18666db6e0db964b2d96d743412f64 100644 --- a/test/webservice_e2e.cpp +++ b/test/webservice_e2e.cpp @@ -3,6 +3,7 @@ #include <ftl/protocol/self.hpp> #include <ftl/protocol/node.hpp> #include <ftl/uri.hpp> +#include <nlohmann/json.hpp> // --- Tests ------------------------------------------------------------------- @@ -19,6 +20,11 @@ TEST_CASE("Webservice connection", "[net]") { REQUIRE( p ); REQUIRE( p->waitConnection(5) ); + + auto details = p->details(); + REQUIRE(details.contains("id")); + + LOG(INFO) << "Details: " << details.dump(); } ftl::protocol::reset();