Skip to content

Instantly share code, notes, and snippets.

@ldm5180
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldm5180/1bbe74ebdc98daf30b99 to your computer and use it in GitHub Desktop.
Save ldm5180/1bbe74ebdc98daf30b99 to your computer and use it in GitHub Desktop.
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