Skip to content

Commit

Permalink
Merge branch 'master' into refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Feb 6, 2012
2 parents 141176f + d16e044 commit 7b58d96
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/recorder.js
Expand Up @@ -61,7 +61,9 @@ function record(dont_print) {
if (! dont_print) { console.log(SEPARATOR + out + SEPARATOR); }
});

callback.apply(res, arguments);
if (callback) {
callback.apply(res, arguments);
}

});
oldWrite = req.write;
Expand Down
12 changes: 12 additions & 0 deletions tests/test_recorder.js
Expand Up @@ -26,4 +26,16 @@ tap.test('records', function(t) {
req.write('ABCDEF');
req.end();
return req;
});

tap.test('checks if callback is specified', function(t) {
var options = {
host: 'www.google.com', method: 'GET', path: '/', port: 80
};

nock.restore();
nock.recorder.rec(true);

http.request(options, undefined).end();
t.end();
});

0 comments on commit 7b58d96

Please sign in to comment.