Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: set correct headers
  • Loading branch information
DiegoRBaquero authored Mar 29, 2020
commit 8b8daa3d4a3db60b1d80db8fc61b828cd85197e6
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`
<h1>${stats.torrents} torrents (${stats.activeTorrents} active)</h1>
<h2>Connected Peers: ${stats.peersAll}</h2>
Expand Down