Skip to content

Commit 8b8daa3

Browse files
fix: set correct headers
1 parent fc4a0f7 commit 8b8daa3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,10 @@ class Server extends EventEmitter {
249249
}
250250

251251
if (req.url === '/stats.json' || req.headers.accept === 'application/json') {
252-
res.write(JSON.stringify(stats))
253-
res.end()
252+
res.setHeader('Content-Type', 'application/json')
253+
res.end(JSON.stringify(stats))
254254
} else if (req.url === '/stats') {
255+
res.setHeader('Content-Type', 'text/html');
255256
res.end(`
256257
<h1>${stats.torrents} torrents (${stats.activeTorrents} active)</h1>
257258
<h2>Connected Peers: ${stats.peersAll}</h2>

0 commit comments

Comments
 (0)