Update webserver.js

Tighten code around sending xml data
This commit is contained in:
Damian Bushong
2013-07-05 11:44:50 -05:00
parent 9c5e9083fe
commit 93f040aea8

View File

@@ -149,13 +149,11 @@ var express = require('express'),
if (cid.match('.rss')) { if (cid.match('.rss')) {
fs.readFile('feeds/categories/' + cid, function (err, data) { fs.readFile('feeds/categories/' + cid, function (err, data) {
if (err) { 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; return;
} }
res.setHeader('Content-Type', 'application/xml'); res.type('xml').set('Content-Length', data.length).send(data);
res.setHeader('Content-Length', data.length);
res.end(data);
}); });
return; return;
} }