nodeload icon indicating copy to clipboard operation
nodeload copied to clipboard

client.request in examples code breaks node.js

Open josephoster opened this issue 12 years ago • 0 comments

'client.request()' is used in five of the /examples files and breaks the current nodeJS (v0.8.9). Example:

requestGenerator: function(client) { return client.request('GET', "/" + Math.floor(Math.random()*8000), { 'host': 'localhost' }); }

terminal output from simpletest.ex.js:

Test server on localhost:9000. http.createClient is deprecated. Use http.request instead. Started HTTP server on localhost:8000.

events.js:66 throw arguments[1]; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:769:11) at Server._listen2 (net.js:909:14) at listen (net.js:936:10) at Server.listen (net.js:985:5) at Object. (/home/joseph/node/load_test.js:15:4) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10)

Changing 'client' to 'http' fixes the problem:

requestGenerator: function(http) { return http.request('GET', "/" + Math.floor(Math.random()*8000), { 'host': 'localhost' }); }

josephoster avatar Sep 16 '12 19:09 josephoster