Skip to content

Commit f5d65cd

Browse files
jkyberneeesCopilot
andauthored
Update lib/middleware/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c8651f7 commit f5d65cd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/middleware/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,14 @@ When using the `verify` option with `createBodyParser`, the raw body is availabl
199199

200200
```javascript
201201
const bodyParser = createBodyParser({
202-
json: {
203-
verify: (req, rawBody) => {
204-
// rawBody is the raw string before parsing
205-
const signature = req.headers.get('x-signature')
206-
if (!verifySignature(rawBody, signature)) {
207-
throw new Error('Invalid signature')
208-
}
209-
},
202+
verify: (req, rawBody) => {
203+
// rawBody is the raw string before parsing
204+
const signature = req.headers.get('x-signature')
205+
if (!verifySignature(rawBody, signature)) {
206+
throw new Error('Invalid signature')
207+
}
210208
},
209+
// Note: any JSON parsing behavior (such as deferNext) is handled internally when verify is set.
211210
})
212211
```
213212

0 commit comments

Comments
 (0)