Skip to content

Instantly share code, notes, and snippets.

@TheFrozenFire
Created November 15, 2013 21:50
Show Gist options
  • Save TheFrozenFire/7492251 to your computer and use it in GitHub Desktop.
Save TheFrozenFire/7492251 to your computer and use it in GitHub Desktop.
var http = require('http');
exports.hooks_queue = function(next, connection) {
var config = this.config.get('http_forward.ini');
var request = http.request(config.receiver, function(response) {
if(response.statusCode == 200) {
next(OK, 'Message delivered to receiver');
} else {
next(DENY, 'Message rejected by receiver: ' + http.STATUS_CODES[response.statusCode]);
}
});
request.on('error', function(error) {
next(DENYSOFT, 'Queue failed due to HTTP error');
});
request.write(connection.transaction.message_stream);
request.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment