test: fix test-http-extra-response flakiness
authorSantiago Gimeno <santiago.gimeno@gmail.com>
Sat, 30 Jan 2016 19:55:07 +0000 (20:55 +0100)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
It can happen that the extra response is to be sent in a different chunk
from the rest of the data. At this moment, the client might have already
closed the socket causing an `ECONNRESET` error.

PR-URL: https://github.com/nodejs/node/pull/4979
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
test/parallel/test-http-extra-response.js

index bfd9b59..fc398b9 100644 (file)
@@ -37,6 +37,10 @@ var server = net.createServer(function(socket) {
       socket.end(fullResponse);
     }
   });
+
+  socket.on('error', function(err) {
+    assert.equal(err.code, 'ECONNRESET');
+  });
 });