You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are use-cases where it would be useful to disable body parsing even if the content-type is application/json. An example would be verifying Stripe's webhook signatures.
From their docs:
Stripe requires the raw body of the request to perform signature verification. If you’re using a framework, make sure it doesn’t manipulate the raw body. Any manipulation to the raw body of the request causes the verification to fail.
Proposal
Adding a rawBody flag on the contract could allow users to disable this automatic behavior when necessary.
Implementation
I was thinking of modifying the following function to something like this.
If this is of interest then I could open a Pull Request with the proposed changes and some tests.
Additional context
I have only used the serverless Next handler and admittedly I haven't given this too much of a thought but perhaps this is something that the other handlers could benefit from ?
The text was updated successfully, but these errors were encountered:
options.rawBodyEndpoints includes list of endpoints that should receive the rawBody.
On the consumer side, I have method for getting the rawBody param
exportfunctionrequestRawBody(req: Request): string|Buffer|undefined{if(!('rawBody'inreq))returnundefined;if(typeofreq.rawBody==='string'||Buffer.isBuffer(req.rawBody))returnreq.rawBody;console.warn('rawBody is not a string or Buffer');returnundefined;}
Problem
There are use-cases where it would be useful to disable body parsing even if the content-type is
application/json
. An example would be verifying Stripe's webhook signatures.From their docs:
Proposal
Adding a
rawBody
flag on the contract could allow users to disable this automatic behavior when necessary.Implementation
I was thinking of modifying the following function to something like this.
If this is of interest then I could open a Pull Request with the proposed changes and some tests.
Additional context
I have only used the serverless Next handler and admittedly I haven't given this too much of a thought but perhaps this is something that the other handlers could benefit from ?
The text was updated successfully, but these errors were encountered: