From b88cdf7d0afee218ff5a89c6b4573327a4d55fa2 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sat, 27 Jul 2019 20:35:35 -0700 Subject: [PATCH] standard --- server.js | 2 +- test/stats.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index f0db1f0..58633d6 100644 --- a/server.js +++ b/server.js @@ -249,7 +249,7 @@ class Server extends EventEmitter { clients: groupByClient() } - if (req.url === '/stats.json' || req.headers['accept'] === 'application/json') { + if (req.url === '/stats.json' || req.headers.accept === 'application/json') { res.write(JSON.stringify(stats)) res.end() } else if (req.url === '/stats') { diff --git a/test/stats.js b/test/stats.js index 15d0c0f..ecc2f2e 100644 --- a/test/stats.js +++ b/test/stats.js @@ -145,7 +145,7 @@ test('server: get leecher stats.json', function (t) { t.equal(stats.peersSeederOnly, 0) t.equal(stats.peersLeecherOnly, 1) t.equal(stats.peersSeederAndLeecher, 0) - t.equal(stats.clients['WebTorrent']['0.91'], 1) + t.equal(stats.clients.WebTorrent['0.91'], 1) client.destroy(function () { t.pass('client destroyed') }) server.close(function () { t.pass('server closed') }) @@ -186,7 +186,7 @@ test('server: get leecher stats.json (unknown peerId)', function (t) { t.equal(stats.peersSeederOnly, 0) t.equal(stats.peersLeecherOnly, 1) t.equal(stats.peersSeederAndLeecher, 0) - t.equal(stats.clients['unknown']['01234567'], 1) + t.equal(stats.clients.unknown['01234567'], 1) client.destroy(function () { t.pass('client destroyed') }) server.close(function () { t.pass('server closed') })