Skip to content

Instantly share code, notes, and snippets.

@gaarf
Created November 6, 2011 03:09
Show Gist options
  • Save gaarf/1342406 to your computer and use it in GitHub Desktop.
Save gaarf/1342406 to your computer and use it in GitHub Desktop.
Expresso or Node 0.6.0 issue?
// expresso
// this worked fine in 0.4.x
// but with node 0.6.0 results in:
// uncaught undefined: Error: connect ECONNREFUSED
// at errnoException (net.js:614:11)
// at Object.afterConnect [as oncomplete] (net.js:605:18)
var http = require('http'),
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
module.exports = {
'my test': function(beforeExit, assert){
var requestsCompleted = 0;
beforeExit(function() {
assert.equal(2, requestsCompleted, 'Both requests completed');
});
assert.response(server,
{ url: '/', method:'GET' },
{ status: 200 },
function(res) {
requestsCompleted++;
console.log('first request completed');
assert.response(server,
{ url: '/', method:'GET' },
{ status: 200 },
function(res) {
requestsCompleted++;
console.log('second request completed');
}
);
}
);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment