Switching node from .send to .sendStatus.

This commit is contained in:
Samuel Clay 2021-10-26 08:33:50 -04:00
parent 2c24866fe0
commit 81ffcc52dc
2 changed files with 6 additions and 6 deletions

View file

@ -25,12 +25,12 @@ original_page = (app) =>
log.debug "Loading: #{feedId} (#{filePath}). " +
"#{if exists then "" else "NOT FOUND"}"
if not exists
return res.send 404
return res.sendStatus 404
fs.stat filePath, (err, stats) ->
if not err and etag and stats.mtime == etag
return res.send 304
return res.sendStatus 304
if not err and lastModified and stats.mtime == lastModified
return res.send 304
return res.sendStatus 304
fs.readFile filePath, (err, content) ->
res.header 'Etag', Date.parse(stats.mtime)

View file

@ -30,14 +30,14 @@
return fs.exists(filePath, function(exists, err) {
log.debug(`Loading: ${feedId} (${filePath}). ` + `${exists ? "" : "NOT FOUND"}`);
if (!exists) {
return res.send(404);
return res.sendStatus(404);
}
return fs.stat(filePath, function(err, stats) {
if (!err && etag && stats.mtime === etag) {
return res.send(304);
return res.sendStatus(304);
}
if (!err && lastModified && stats.mtime === lastModified) {
return res.send(304);
return res.sendStatus(304);
}
return fs.readFile(filePath, function(err, content) {
res.header('Etag', Date.parse(stats.mtime));