@middy/http-json-body-parser 2.5.0 → 2.5.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +1 -0
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -32,6 +32,8 @@ if used in combination with `httpErrorHandler`.
32
32
  It can also be used in combination with validator as a prior step to normalize the
33
33
  event body input as an object so that the content can be validated.
34
34
 
35
+ If the body has been parsed as JSON, you can access the original body (e.g. for webhook signature validation) through the `request.event.rawBody`.
36
+
35
37
 
36
38
  ## Install
37
39
 
package/index.js CHANGED
@@ -22,6 +22,7 @@ const httpJsonBodyParserMiddleware = (opts = {}) => {
22
22
  if (mimePattern.test(contentTypeHeader)) {
23
23
  try {
24
24
  const data = request.event.isBase64Encoded ? Buffer.from(body, 'base64').toString() : body;
25
+ request.event.rawBody = body;
25
26
  request.event.body = JSON.parse(data, options.reviver);
26
27
  } catch (err) {
27
28
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-json-body-parser",
3
- "version": "2.5.0",
3
+ "version": "2.5.4",
4
4
  "description": "Http JSON body parser middleware for the middy framework",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -48,11 +48,11 @@
48
48
  },
49
49
  "homepage": "https://github.com/middyjs/middy#readme",
50
50
  "dependencies": {
51
- "@middy/util": "^2.5.0"
51
+ "@middy/util": "^2.5.4"
52
52
  },
53
53
  "devDependencies": {
54
- "@middy/core": "^2.5.0",
54
+ "@middy/core": "^2.5.4",
55
55
  "http-errors": "^1.8.0"
56
56
  },
57
- "gitHead": "76d2bc02b48a4bbd054904538f5c4798ba3c4f7f"
57
+ "gitHead": "a4134a579c757a9fdfed3006877ba2c0ec8a2cfa"
58
58
  }