0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

don't send etags with errors

This commit is contained in:
Alex Kocharin 2013-12-06 21:46:11 +04:00
parent 9ee8d484db
commit 6a295ac196

View file

@ -110,7 +110,10 @@ module.exports.log_and_etagify = function(req, res, next) {
body = JSON.stringify(body, undefined, '\t')
}
res.header('ETag', '"' + md5sum(body) + '"')
// don't send etags with errors
if (!res.statusCode || (res.statusCode >= 200 && res.statusCode < 300)) {
res.header('ETag', '"' + md5sum(body) + '"')
}
} else {
// send(null), send(204), etc.
}