From 0f77300472118941689f4afb537ed4dc4aec9025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=C2=A0F=2E=20Romaniello?= Date: Thu, 6 Sep 2018 16:04:33 -0300 Subject: [PATCH] expose serverProperties in the connection object --- lib/connection.js | 1 + test/connect.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index b63a7b1d..f65138c5 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -205,6 +205,7 @@ C.open = function(allFields, openCallback0) { allFields.mechanism))); return; } + self.serverProperties = start.fields.serverProperties; send(defs.ConnectionStartOk); wait(afterStartOk); } diff --git a/test/connect.js b/test/connect.js index e44c38b6..efc55fea 100644 --- a/test/connect.js +++ b/test/connect.js @@ -79,6 +79,17 @@ suite("Connect API", function() { connect(u, {}, kCallback(fail(done), succeed(done))); }); + test("serverProperties", function(done) { + var url = require('url'); + var parts = url.parse(URL, true); + var config = parts.query || {}; + connect(config, {}, function(err, connection) { + if (err) { return done(err); } + assert.equal(connection.serverProperties.product, 'RabbitMQ'); + done(); + }); + }); + test("using custom heartbeat option", function(done) { var url = require('url'); var parts = url.parse(URL, true);