From 8b8daa3d4a3db60b1d80db8fc61b828cd85197e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Sun, 29 Mar 2020 12:32:31 -0500 Subject: [PATCH] fix: set correct headers --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 80f5cf5..e940e35 100644 --- a/server.js +++ b/server.js @@ -249,9 +249,10 @@ class Server extends EventEmitter { } if (req.url === '/stats.json' || req.headers.accept === 'application/json') { - res.write(JSON.stringify(stats)) - res.end() + res.setHeader('Content-Type', 'application/json') + res.end(JSON.stringify(stats)) } else if (req.url === '/stats') { + res.setHeader('Content-Type', 'text/html'); res.end(`

${stats.torrents} torrents (${stats.activeTorrents} active)

Connected Peers: ${stats.peersAll}