@middy/http-multipart-body-parser 6.2.3 → 6.2.4
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 +8 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -17,13 +17,6 @@ const httpMultipartBodyParserMiddleware = (opts = {}) => {
|
|
|
17
17
|
|
|
18
18
|
const httpMultipartBodyParserMiddlewareBefore = async (request) => {
|
|
19
19
|
const { headers, body } = request.event;
|
|
20
|
-
if (typeof body === "undefined") {
|
|
21
|
-
throw createError(
|
|
22
|
-
415,
|
|
23
|
-
"Invalid or malformed multipart/form-data was provided",
|
|
24
|
-
{ cause: { package: "@middy/http-multipart-body-parser", data: body } },
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
20
|
|
|
28
21
|
const contentType = headers?.["content-type"] ?? headers?.["Content-Type"];
|
|
29
22
|
|
|
@@ -39,6 +32,14 @@ const httpMultipartBodyParserMiddleware = (opts = {}) => {
|
|
|
39
32
|
});
|
|
40
33
|
}
|
|
41
34
|
|
|
35
|
+
if (typeof body === "undefined") {
|
|
36
|
+
throw createError(
|
|
37
|
+
415,
|
|
38
|
+
"Invalid or malformed multipart/form-data was provided",
|
|
39
|
+
{ cause: { package: "@middy/http-multipart-body-parser", data: body } },
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
42
43
|
return parseMultipartData(request.event, options)
|
|
43
44
|
.then((multipartData) => {
|
|
44
45
|
// request.event.rawBody = body
|