This commit is contained in:
Feross Aboukhadijeh 2019-07-27 20:35:35 -07:00
parent bf709ccd07
commit b88cdf7d0a
2 changed files with 3 additions and 3 deletions

View File

@ -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') {

View File

@ -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') })