@middy/http-multipart-body-parser 6.2.3 → 6.3.0

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.
Files changed (2) hide show
  1. package/index.js +8 -7
  2. 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-multipart-body-parser",
3
- "version": "6.2.3",
3
+ "version": "6.3.0",
4
4
  "description": "Http event normalizer middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {