Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Mar 10, 2024
1 parent 14a6f73 commit 579fe07
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/client-request.js
Expand Up @@ -14,6 +14,41 @@ const { promisify } = require('node:util')
const { NotSupportedError } = require('../lib/core/errors')
const { parseFormDataString } = require('./utils/formdata')

test('request dump big', async (t) => {
t = tspl(t, { plan: 3 })

const server = createServer((req, res) => {
res.setHeader('content-length', 999999999)
while (res.write('asd')) {
// Do nothing...
}
res.on('drain', () => t.fail())
})
after(() => server.close())

server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
after(() => client.destroy())

let dumped = false
client.on('disconnect', () => {
t.strictEqual(dumped, true)
})
client.request({
path: '/',
method: 'GET'
}, (err, { body }) => {
t.ifError(err)
body.dump().then(() => {
dumped = true
t.ok(true, 'pass')
})
})
})

await t.completed
})

test('request dump', async (t) => {
t = tspl(t, { plan: 3 })

Expand Down

0 comments on commit 579fe07

Please sign in to comment.