Permalink
Browse files

get the response with 3-arg cb(req,res,bounce)

  • Loading branch information...
substack committed Dec 15, 2012
1 parent 162cd50 commit 30978dfcf79f1acf83a5cef4f272549f945420e2
Showing with 5 additions and 3 deletions.
  1. +4 −1 index.js
  2. +1 −2 test/response.js
View
@@ -21,7 +21,10 @@ var bouncy = module.exports = function (opts, cb) {
var server = createServer(function (req, res) {
var bounce = makeBounce(req, res);
- cb(req, bounce);
+ if (cb.length === 3) {
+ cb(req, res, bounce);
+ }
+ else cb(req, bounce);
});
server.on('upgrade', function (req, sock, buf) {
View
@@ -6,10 +6,9 @@ test('response', function (t) {
t.plan(4);
var port = Math.floor(Math.random() * 5e4 + 1e4);
- var server = bouncy(function (req, bounce) {
+ var server = bouncy(function (req, res, bounce) {
t.equal(req.url, '/beep');
- var res = bounce.respond();
res.setHeader('content-type', 'text/plain');
res.end('beep boop');
});

0 comments on commit 30978df

Please sign in to comment.