Skip to content

Commit

Permalink
feat: upgrade busboy
Browse files Browse the repository at this point in the history
Closes #1145
  • Loading branch information
willfarrell committed Dec 3, 2023
1 parent 0bc7e67 commit a449c5f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 223 deletions.
8 changes: 4 additions & 4 deletions packages/http-multipart-body-parser/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ test('It should handle more invalid form data as an UnprocessableEntity', async
await handler(event, defaultContext)
} catch (e) {
t.is(e.message, 'Invalid or malformed multipart/form-data was provided')
t.is(e.cause.data.message, 'Unexpected end of form')
t.is(e.cause.data.message, 'Unexpected end of multipart data')
}
})

Expand Down Expand Up @@ -301,9 +301,9 @@ test('It should parse an array from a multipart/form-data request (binary)', asy
t.deepEqual(response, {
file: {
content: Buffer.from(''),
encoding: 'binary',
filename: 'file.bat',
mimetype: 'application/octet-stream',
encoding: undefined, // 'binary',
filename: undefined, // 'file.bat',
mimetype: undefined, // 'application/octet-stream',
truncated: false
}
})
Expand Down
4 changes: 2 additions & 2 deletions packages/http-multipart-body-parser/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BusBoy from 'busboy'
import BusBoy from '@fastify/busboy'
import { createError } from '@middy/util'

const mimePattern = /^multipart\/form-data(;.*)?$/
Expand Down Expand Up @@ -97,7 +97,7 @@ const parseMultipartData = (event, options) => {
multipartData[matches[1]].push(value)
}
})
.on('close', () => resolve(multipartData))
.on('finish', () => resolve(multipartData))
.on('error', (e) => reject(e))

busboy.write(event.body, charset)
Expand Down
222 changes: 6 additions & 216 deletions packages/http-multipart-body-parser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/http-multipart-body-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
"dependencies": {
"@middy/util": "5.0.3",
"busboy": "1.6.0"
"@fastify/busboy": "2.1.0"
},
"devDependencies": {
"@middy/core": "5.0.3",
Expand Down

0 comments on commit a449c5f

Please sign in to comment.