Created
June 14, 2016 13:57
-
-
Save evantahler/dc95c54133f9f73d78cea152352e2c95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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