Skip to content
Snippets Groups Projects
Commit 155da7ec authored by Nicolas Pope's avatar Nicolas Pope
Browse files

#51 Fix for node details bug

parent 52b776cd
Branches
Tags
No related merge requests found
......@@ -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() {
......
......@@ -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()};
});
}
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment