Thursday, 15 March 2012

javascript - Node JS HTTP Server request.on('data') event failure -



javascript - Node JS HTTP Server request.on('data') event failure -

i working on nodeacs app in have send xml request java http client , receive response after manipulation. java http client working fine far issue node js file. req.on('data'...) event not firing in case. next code of js file:

function index(req, res) { console.log(req.headers); //its getting printed on console req.on('data', function (data) { console.log("inside 1"); //not printed on console ....rest of code.... }); req.on('end', function () { res.writehead(200); res.end(); }); }

in above code after getting request index function called , printing output console.log(req.headers); mentioned above script not running after that. please help me out missing in this.

for testing have installed curl on scheme , sending post request server using curl request using next command:

curl -x post -d @output.xml http://localhost:7788/

can confirm aren't consuming body prior this? if body has been consumed middleware body-parser need restream body via connect-restreamer. if consumed, info event not emitted.

if checks out, check see if "end" event beingness emitted. sign of content-length header beingness set wrong value.

javascript node.js express windows-7 titanium

No comments:

Post a Comment