From c9cd6d2ad324e0e6222932c8f29f27621071e045 Mon Sep 17 00:00:00 2001 From: yawnt Date: Fri, 13 Sep 2013 19:07:34 +0200 Subject: [PATCH] [fix] make @mmalecki a happy camper --- lib/caronte.js | 4 +--- lib/caronte/index.js | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/caronte.js b/lib/caronte.js index ed5e425..444e8fd 100644 --- a/lib/caronte.js +++ b/lib/caronte.js @@ -51,6 +51,7 @@ proxy.createProxyServer = function createProxyServer(options) { options.ee = new events.EventEmitter2({ wildcard: true, delimiter: ':' }); return { + ee : options.ee, web : caronte.createWebProxy(options), ws : caronte.createWsProxy(options), listen : function listen(port) { @@ -63,9 +64,6 @@ proxy.createProxyServer = function createProxyServer(options) { server.listen(port); return server; - }, - emitter : function() { - return options.ee; } }; }; diff --git a/lib/caronte/index.js b/lib/caronte/index.js index 747a64b..194676e 100644 --- a/lib/caronte/index.js +++ b/lib/caronte/index.js @@ -30,9 +30,12 @@ function createRightProxy(type) { return passes[pass]; }); - return function(req, res) { + return function(req, res, opts) { var self = this, ev = 'caronte:' + type + ':'; + + if(typeof opts !== 'undefined') { options = opts; } + options.ee.emit(ev + 'begin', req, res);