kilianc/node-apiserver

streaming response should check and fix trailing/missing commas

Closed this issue · 1 comments

Apiserver streamResponseData prototype:

ApiServer.prototype.streamResponseData = function(sender, request, response, responseChunk, isLast)

the server should check a missing isLast == true responseStreamData event ading a dummy empty object,
or responding with an error.

self.emit("responseStreamData", request, response, obj1, false);
self.emit("responseStreamEnd", request, response); //error

It should also check a double isLast == true responseStreamData event.

self.emit("responseStreamData", request, response, obj1, true);
self.emit("responseStreamData", request, response, obj2, true); //error

fixed in v0.2.0