Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 29, 2010
2 parents c5f5aad + 8d5875d commit c0e8ede
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bin/expresso
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,27 @@ assert.length = function(val, n, msg) {
*/

assert.response = function(server, req, res, msg){
// Check that the server is ready or defer
if (!server.fd) {
if (!('__deferred' in server)) {
server.__deferred = [];
}
server.__deferred.push(arguments);
if (!server.__started) {
server.listen(server.__port = port++, '127.0.0.1', function(){
if (server.__deferred) {
process.nextTick(function(){
server.__deferred.forEach(function(args){
assert.response.apply(assert, args);
});
});
}
});
server.__started = true;
}
return;
}

// Callback as third or fourth arg
var callback = typeof res === 'function'
? res
Expand Down

0 comments on commit c0e8ede

Please sign in to comment.