You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
656 B
30 lines
656 B
4 weeks ago
|
var Buffer = require('buffer').Buffer
|
||
|
var fs = require('fs')
|
||
|
var test = require('tape')
|
||
|
|
||
|
var http = require('../..')
|
||
|
|
||
|
var reference = fs.readFileSync(__dirname + '/../server/static/basic.txt')
|
||
|
|
||
|
test('get body empty', function (t) {
|
||
|
var req = http.request({
|
||
|
path: '/verifyEmpty',
|
||
|
method: 'GET'
|
||
|
}, function (res) {
|
||
|
var buffers = []
|
||
|
|
||
|
res.on('end', function () {
|
||
|
console.log(Buffer.concat(buffers).toString('utf8'))
|
||
|
t.ok(Buffer.from('empty').equals(Buffer.concat(buffers)), 'response body indicates request body was empty')
|
||
|
t.end()
|
||
|
})
|
||
|
|
||
|
res.on('data', function (data) {
|
||
|
buffers.push(data)
|
||
|
})
|
||
|
})
|
||
|
|
||
|
req.write(reference)
|
||
|
req.end()
|
||
|
})
|