-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[now-node] Fix helpers when POST json has empty body #3177
Conversation
It looks like the unit tests need to be updated 🤔 |
@@ -78,13 +82,15 @@ function status(res: NowResponse, statusCode: number): NowResponse { | |||
} | |||
|
|||
function setCharset(type: string, charset: string) { | |||
// eslint-disable-next-line @typescript-eslint/no-var-requires |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a single line for these at the beginning of the file OR if the rule doesn't make sense for us, you can turn it off for the whole repo in eslintrc.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🙏
The `@now/node` helpers json parsing is too strict and doesn't match the behavior of Express when an incoming request has `{ method: 'POST', Content-Type: 'application/json', body: '' }`. Instead of returning 400, this PR will continue with `body = {}` to match Express. Fixes https://spectrum.chat/zeit/now/klarna-with-zeit-now~60852003-4db6-4ec4-a611-83b2349ece08
The
@now/node
helpers json parsing is too strict and doesn't match the behavior of Express when an incoming request has{ method: 'POST', Content-Type: 'application/json', body: '' }
.Instead of returning 400, this PR will continue with
body = {}
to match Express.Fixes https://spectrum.chat/zeit/now/klarna-with-zeit-now~60852003-4db6-4ec4-a611-83b2349ece08