-
-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
X
Plugin version
X
Node.js version
20
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
Latest
Description
I want to merge @fastify/busboy into undici, but a specific test will not currently pass:
test('busboy emit error', async (t) => {
t.plan(1)
const formData = new FormData()
formData.append('field1', 'value1')
const tempRes = new Response(formData)
const formRaw = await tempRes.text()
const server = createServer((req, res) => {
res.setHeader('content-type', 'multipart/form-data; boundary=wrongboundary')
res.write(formRaw)
res.end()
})
t.teardown(server.close.bind(server))
const listen = promisify(server.listen.bind(server))
await listen(0)
const res = await fetch(`http://localhost:${server.address().port}`)
await t.rejects(res.formData(), 'Unexpected end of multipart data')
})Busboy ignores this input rather than throwing for malformed boundary
I found within the code a part that should throw in this case (if I'm not mistaken), but it's not working in practice
I will take a look at this myself, but if anyone could help, it would be highly appreciated
Steps to Reproduce
Run this test after replacing busboy with @fastify/busboy in undici:
test('busboy emit error', async (t) => {
t.plan(1)
const formData = new FormData()
formData.append('field1', 'value1')
const tempRes = new Response(formData)
const formRaw = await tempRes.text()
const server = createServer((req, res) => {
res.setHeader('content-type', 'multipart/form-data; boundary=wrongboundary')
res.write(formRaw)
res.end()
})
t.teardown(server.close.bind(server))
const listen = promisify(server.listen.bind(server))
await listen(0)
const res = await fetch(`http://localhost:${server.address().port}`)
await t.rejects(res.formData(), 'Unexpected end of multipart data')
})Expected Behavior
Test should pass
Metadata
Metadata
Assignees
Labels
No labels