mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 02:21:36 +00:00
standard
This commit is contained in:
parent
bf709ccd07
commit
b88cdf7d0a
@ -249,7 +249,7 @@ class Server extends EventEmitter {
|
|||||||
clients: groupByClient()
|
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.write(JSON.stringify(stats))
|
||||||
res.end()
|
res.end()
|
||||||
} else if (req.url === '/stats') {
|
} else if (req.url === '/stats') {
|
||||||
|
@ -145,7 +145,7 @@ test('server: get leecher stats.json', function (t) {
|
|||||||
t.equal(stats.peersSeederOnly, 0)
|
t.equal(stats.peersSeederOnly, 0)
|
||||||
t.equal(stats.peersLeecherOnly, 1)
|
t.equal(stats.peersLeecherOnly, 1)
|
||||||
t.equal(stats.peersSeederAndLeecher, 0)
|
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') })
|
client.destroy(function () { t.pass('client destroyed') })
|
||||||
server.close(function () { t.pass('server closed') })
|
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.peersSeederOnly, 0)
|
||||||
t.equal(stats.peersLeecherOnly, 1)
|
t.equal(stats.peersLeecherOnly, 1)
|
||||||
t.equal(stats.peersSeederAndLeecher, 0)
|
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') })
|
client.destroy(function () { t.pass('client destroyed') })
|
||||||
server.close(function () { t.pass('server closed') })
|
server.close(function () { t.pass('server closed') })
|
||||||
|
Loading…
Reference in New Issue
Block a user