Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LineRate HTTP Status Cats
var cats = require('http-status-cats').cats;
var vsm = require('lrs/virtualServerModule');
function addRespHandler(req, res, next) {
next.on('response', function(clires) {
clires.bindHeaders(res);
res.setHeader('X-Status-Cat', cats[clires.statusCode]);
clires.fastPipe(res);
});
next();
}
vsm.on('exist', 'vs', function(vs) { vs.on('request', addRespHandler); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment