Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed May 8, 2024
1 parent 258da73 commit 513a7c2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/client-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@ const { promisify } = require('node:util')
const { NotSupportedError, InvalidArgumentError } = require('../lib/core/errors')
const { parseFormDataString } = require('./utils/formdata')


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

const server = createServer((req, res) => {
res.setHeader('content-length', 5 * 100)
res.flushHeaders()
res.write('hello'.repeat(100))
})
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: 'HEAD'
}, (err, { body }) => {
t.ifError(err)
body.dump({ limit: 1}).then(() => {
dumped = true
t.ok(true, 'pass')
})
})
})

await t.completed
})

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

Expand Down

0 comments on commit 513a7c2

Please sign in to comment.