diff --git a/test/parallel/test-http-upgrade-agent.js b/test/parallel/test-http-upgrade-agent.js index 91fe495da2f49e..7590354f50b393 100644 --- a/test/parallel/test-http-upgrade-agent.js +++ b/test/parallel/test-http-upgrade-agent.js @@ -46,9 +46,14 @@ srv.listen(common.PORT, '127.0.0.1', function() { req.end(); req.on('upgrade', function(res, socket, upgradeHead) { - // XXX: This test isn't fantastic, as it assumes that the entire response - // from the server will arrive in a single data callback - assert.equal(upgradeHead, 'nurtzo'); + var recvData = upgradeHead; + socket.on('data', function(d) { + recvData += d; + }); + + socket.on('close', common.mustCall(function() { + assert.equal(recvData, 'nurtzo'); + })); console.log(res.headers); var expectedHeaders = { 'hello': 'world',