@middy/http-json-body-parser 4.0.0 → 4.0.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/README.md +0 -62
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -36,68 +36,6 @@
36
36
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/http-json-body-parser">https://middy.js.org/docs/middlewares/http-json-body-parser</a></p>
37
37
  </div>
38
38
 
39
- This middleware automatically parses HTTP requests with a JSON body and converts the body into an
40
- object. Also handles gracefully broken JSON as *UnprocessableEntity* (422 errors)
41
- if used in combination with `httpErrorHandler`.
42
-
43
- It can also be used in combination with validator as a prior step to normalize the
44
- event body input as an object so that the content can be validated.
45
-
46
- 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`.
47
-
48
-
49
- ## Install
50
-
51
- To install this middleware you can use NPM:
52
-
53
- ```bash
54
- npm install --save @middy/http-json-body-parser
55
- ```
56
-
57
-
58
- ## Options
59
-
60
- - `reviver` (function) (default `undefined`): A [reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Parameters) parameter may be passed which will be used `JSON.parse`ing the body.
61
-
62
-
63
- ## Sample usage
64
-
65
- ```javascript
66
- import middy from '@middy/core'
67
- import httpHeaderNormalizer from '@middy/http-header-normalizer'
68
- import httpJsonBodyParser from '@middy/http-json-body-parser'
69
-
70
- const handler = middy((event, context) => {
71
- return {}
72
- })
73
-
74
- handler
75
- .use(httpHeaderNormalizer())
76
- .use(httpJsonBodyParser())
77
-
78
- // invokes the handler
79
- const event = {
80
- headers: {
81
- 'Content-Type': 'application/json' // It is important that the request has the proper content type.
82
- },
83
- body: JSON.stringify({foo: 'bar'})
84
- }
85
- handler(event, {}, (_, body) => {
86
- t.is(body,{foo: 'bar'})
87
- })
88
- ```
89
-
90
-
91
- ## Middy documentation and examples
92
-
93
- For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
94
-
95
-
96
- ## Contributing
97
-
98
- Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
99
-
100
-
101
39
  ## License
102
40
 
103
41
  Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-json-body-parser",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Http JSON body parser middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -64,12 +64,12 @@
64
64
  },
65
65
  "homepage": "https://middy.js.org",
66
66
  "dependencies": {
67
- "@middy/util": "4.0.0"
67
+ "@middy/util": "4.0.2"
68
68
  },
69
69
  "devDependencies": {
70
- "@middy/core": "4.0.0",
70
+ "@middy/core": "4.0.2",
71
71
  "@types/aws-lambda": "^8.10.101",
72
72
  "type-fest": "^3.0.0"
73
73
  },
74
- "gitHead": "582286144bcd79968a8c7c2f8867a23c80079a47"
74
+ "gitHead": "c77c9413ecb80999a71b67ff97edac1fed2ca754"
75
75
  }