Skip to content

Commit

Permalink
Update webserver.js
Browse files Browse the repository at this point in the history
Forgot this section - also use text/plain mimetype since we're not responding using XML to errors; if we're going to do that, we need to do it right in the first place.
  • Loading branch information
katanacrimson committed Jul 5, 2013
1 parent 93f040a commit cec2381
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,11 @@ var express = require('express'),
if (tid.match('.rss')) {
fs.readFile('feeds/topics/' + tid, function (err, data) {
if (err) {
res.send("Unable to locate an rss feed at this location.");
res.type('text').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;
}
Expand All @@ -149,7 +147,7 @@ var express = require('express'),
if (cid.match('.rss')) {
fs.readFile('feeds/categories/' + cid, function (err, data) {
if (err) {
res.send(404, "Unable to locate an rss feed at this location.");
res.type('text').send(404, "Unable to locate an rss feed at this location.");
return;
}

Expand Down

0 comments on commit cec2381

Please sign in to comment.