diff --git a/server.js b/server.js index 62ca7be..b27930b 100644 --- a/server.js +++ b/server.js @@ -196,7 +196,7 @@ function Server (opts) { peersIPv6: countPeers(isIPv6) } - if (req.url === '/stats.json' || req.headers['content-type'] === '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 8971cd6..445bc48 100644 --- a/test/stats.js +++ b/test/stats.js @@ -60,7 +60,7 @@ test('server: get empty stats with json header', function (t) { var opts = { url: announceUrl.replace('/announce', '/stats'), headers: { - 'content-type': 'json' + 'accept': 'application/json' }, json: true } @@ -134,7 +134,6 @@ test('server: get leecher stats.json', function (t) { get.concat(opts, function (err, res, stats) { t.error(err) - console.log(stats) t.equal(res.statusCode, 200) t.equal(stats.torrents, 1)