@middy/http-json-body-parser 7.1.1 → 7.1.2

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 +2 -4
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
2
2
  // SPDX-License-Identifier: MIT
3
- import { createError } from "@middy/util";
3
+ import { createError, decodeBody } from "@middy/util";
4
4
 
5
5
  const mimePattern = /^application\/(.+\+)?json($|;.+)/;
6
6
 
@@ -32,9 +32,7 @@ const httpJsonBodyParserMiddleware = (opts = {}) => {
32
32
  }
33
33
 
34
34
  try {
35
- const data = request.event.isBase64Encoded
36
- ? Buffer.from(body, "base64").toString()
37
- : body;
35
+ const data = decodeBody(request.event);
38
36
 
39
37
  request.event.body = JSON.parse(data, options.reviver);
40
38
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-json-body-parser",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "description": "HTTP JSON body parser middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -67,10 +67,10 @@
67
67
  "url": "https://github.com/sponsors/willfarrell"
68
68
  },
69
69
  "dependencies": {
70
- "@middy/util": "7.1.1"
70
+ "@middy/util": "7.1.2"
71
71
  },
72
72
  "devDependencies": {
73
- "@middy/core": "7.1.1",
73
+ "@middy/core": "7.1.2",
74
74
  "@types/aws-lambda": "^8.0.0",
75
75
  "type-fest": "^5.0.0"
76
76
  },