Skip to content

Instantly share code, notes, and snippets.

@evantahler
Created June 14, 2016 13:57
Show Gist options
  • Save evantahler/dc95c54133f9f73d78cea152352e2c95 to your computer and use it in GitHub Desktop.
Save evantahler/dc95c54133f9f73d78cea152352e2c95 to your computer and use it in GitHub Desktop.
module.exports = {
loadPriority: 1001, // to be sure connection is defined already
initialize: function(api, next){
api.connection.prototype.responseCode = function(code){
if(this.type !== 'web'){ throw new error('only for web servers'); }
this.rawConnection.responseHttpCode = code;
};
api.connection.prototype.header = function(key, value){
if(this.type !== 'web'){ throw new error('only for web servers'); }
this.rawConnection.responseHeaders.push([key,value]);
};
next();
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment