diff --git a/lib/server/index.js b/lib/server/index.js index 603417865..e2491c020 100644 --- a/lib/server/index.js +++ b/lib/server/index.js @@ -21,8 +21,10 @@ module.exports = ({ config = {}, port = null, filters = {} }) => { const id = req.params.id; if (connections.has(id)) { - const metadata = connections.get(id)[0].metadata; - return res.status(200).json({ ok: true, version: metadata.version }); + const clientsMetadata = connections.get(id).map(conn => ({ + version: conn.metadata && conn.metadata.version, + })); + return res.status(200).json({ ok: true, clients: clientsMetadata }); } debug('no broker found matching "%s"', id); return res.status(404).json({ ok: false }); diff --git a/test/functional/healthcheck.test.js b/test/functional/healthcheck.test.js index 78ad496b6..342d15f08 100644 --- a/test/functional/healthcheck.test.js +++ b/test/functional/healthcheck.test.js @@ -72,7 +72,7 @@ test('proxy requests originating from behind the broker client', t => { t.equal(res.statusCode, 200, '200 statusCode'); t.equal(res.body.ok, true, '{ ok: true } in body'); - t.ok(res.body.version, 'version in body'); + t.ok(res.body.clients[0].version, 'client version in body'); t.end(); }); }); @@ -97,7 +97,7 @@ test('proxy requests originating from behind the broker client', t => { t.equal(res.statusCode, 200, '200 statusCode'); t.equal(res.body.ok, true, '{ ok: true } in body'); - t.ok(res.body.version, 'version in body'); + t.ok(res.body.clients[0].version, 'client version in body'); t.end(); }); }, 20);