@middy/http-multipart-body-parser 5.0.1 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -4
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { createError } from '@middy/util';
|
|
|
3
3
|
const mimePattern = /^multipart\/form-data(;.*)?$/;
|
|
4
4
|
const fieldnamePattern = /(.+)\[(.*)]$/;
|
|
5
5
|
const defaults = {
|
|
6
|
-
// busboy options as per documentation: https://www.npmjs.com/package/busboy#busboy-methods
|
|
7
6
|
busboy: {},
|
|
8
7
|
charset: 'utf8',
|
|
9
8
|
disableContentTypeError: false
|
|
@@ -28,10 +27,8 @@ const httpMultipartBodyParserMiddleware = (opts = {})=>{
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
return parseMultipartData(request.event, options).then((multipartData)=>{
|
|
31
|
-
// request.event.rawBody = body
|
|
32
30
|
request.event.body = multipartData;
|
|
33
31
|
}).catch((err)=>{
|
|
34
|
-
// UnprocessableEntity
|
|
35
32
|
throw createError(415, 'Invalid or malformed multipart/form-data was provided', {
|
|
36
33
|
cause: {
|
|
37
34
|
package: '@middy/multipart-body-parser',
|
|
@@ -47,7 +44,6 @@ const httpMultipartBodyParserMiddleware = (opts = {})=>{
|
|
|
47
44
|
const parseMultipartData = (event, options)=>{
|
|
48
45
|
const multipartData = {};
|
|
49
46
|
const charset = event.isBase64Encoded ? 'base64' : options.charset;
|
|
50
|
-
// header must be lowercase (content-type)
|
|
51
47
|
const busboy = BusBoy({
|
|
52
48
|
...options.busboy,
|
|
53
49
|
headers: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-multipart-body-parser",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Http event normalizer middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"url": "https://github.com/sponsors/willfarrell"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@middy/util": "5.0.
|
|
63
|
+
"@middy/util": "5.0.3",
|
|
64
64
|
"busboy": "1.6.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@middy/core": "5.0.
|
|
67
|
+
"@middy/core": "5.0.3",
|
|
68
68
|
"@types/aws-lambda": "^8.10.101",
|
|
69
69
|
"type-fest": "^4.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "87660575a7ac2b52e4153c407a4c63c9449dcd0d"
|
|
72
72
|
}
|