jeudi 16 avril 2015

Node.js do I have to define on "data" event for GET requests?

What if someone sends a GET request with a body, or a POST request but without a body. In both cases, do I have still have to define the on "data" event?





request.on ("data", function (chunk) {

// Might be a GET request or whatever.
// Doesn't get fired when there is no body,
// but must be present otherwise on "end" doesn't get fired

});

request.on ("end", function () {

// Doesn't get fired unless on "data" is present
// even if there is no body

});



Thanks.


Aucun commentaire:

Enregistrer un commentaire