Skip to content

Commit

Permalink
Don't end response early in tests/test-pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
mscdex committed Oct 19, 2016
1 parent 95b743f commit 3804428
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test-pipes.js
Expand Up @@ -210,7 +210,7 @@ tape('pause before piping from a request object', function(t) {
}, 100)
})

var fileContents = fs.readFileSync(__filename).toString()
var fileContents = fs.readFileSync(__filename)
function testPipeFromFile(testName, hasContentLength) {
tape(testName, function(t) {
s.once('/pushjs', function(req, res) {
Expand All @@ -220,13 +220,16 @@ function testPipeFromFile(testName, hasContentLength) {
req.headers['content-length'],
(hasContentLength ? '' + fileContents.length : undefined))
var body = ''
req.setEncoding('utf8')
req.on('data', function(data) {
body += data
})
req.on('end', function() {
t.equal(body, fileContents)
res.end()
t.equal(body, fileContents.toString())
t.end()
})
} else {
res.end()
}
})
Expand Down

0 comments on commit 3804428

Please sign in to comment.