node.js - Handle response using transfer-encoding: gzip,chunked -


After

I am trying to handle the response using the transfer-encoding. Gzip, chunked

You run the code given below (like node server.js ), you should get "foobar" in your console but this process is hanging is.

  var requires HTTP = ('http'); Var request = requirement ('request'); Var requires ZLib = ('zlib'); Var server = http.createServer (); Server.on ('request', function (req, res) {res.setHeader ('transfer-encoding', 'gzip, chunked'); ZLib.gzip ('foo', function (error, buffer) {res.write (Buffer); ZLib.gzip ('bar', function (error, buffer 2) {res.write (buffer2); res.end ();});});}); Server.listen (3001); ({Gzip: true, url: 'http: // localhost: 3001'}, function (error, feedback, body) {if (error) console.error (error); console.log (body);});  

I checked the code with curl localhost: 3001 and it is responding to "phobor" as expected, so can handle the node. Transfer-encoding: gzip, chunked ? Or am I doing something wrong?


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -