From 93f040aea88eda006f328dba0b0780ad481b9413 Mon Sep 17 00:00:00 2001 From: Damian Bushong Date: Fri, 5 Jul 2013 11:44:50 -0500 Subject: [PATCH] Update webserver.js Tighten code around sending xml data --- src/webserver.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/webserver.js b/src/webserver.js index 860130baca..9d2ef218e6 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -149,13 +149,11 @@ var express = require('express'), if (cid.match('.rss')) { fs.readFile('feeds/categories/' + cid, function (err, data) { if (err) { - res.send("Unable to locate an rss feed at this location."); + res.send(404, "Unable to locate an rss feed at this location."); return; } - res.setHeader('Content-Type', 'application/xml'); - res.setHeader('Content-Length', data.length); - res.end(data); + res.type('xml').set('Content-Length', data.length).send(data); }); return; } @@ -352,4 +350,4 @@ var express = require('express'), }(WebServer)); server.listen(config.port); -global.server = server; \ No newline at end of file +global.server = server;