Created
January 16, 2012 21:35
-
-
Save russellhaering/1623151 to your computer and use it in GitHub Desktop.
double callback introduced to node in 07c27e040eb41a1f564f1d92dbe1ad07b78f3a4e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
function main() { | |
var fired = 0, req; | |
req = https.request({ | |
host: 'localhost', | |
port: 8052, | |
path: '/', | |
method: 'GET' | |
}); | |
req.on('error', function(err) { | |
fired++; | |
console.log('error callback fired: ' + err.toString()); | |
}); | |
setTimeout(function() { | |
if (fired !== 1) { | |
console.error('multiple error callbacks: ' + fired); | |
} else { | |
console.log('1 error callback, good!'); | |
} | |
}, 5000); | |
req.end(); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment