-
-
Notifications
You must be signed in to change notification settings - Fork 728
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
textParser returns an object when body is empty #44
Comments
Yes. The reason is historical that |
I'd think that in the case of |
Yeah, definitely should be an empty string in that case! I'd expect undef if there was no body. |
Right. I'm not disagreeing, but I was just saying the reason it's set to |
Anyway, if you post a body that is plain text and the body is empty (so |
The test https://github.com/expressjs/body-parser/blob/1.7.0/test/text.js#L33-L42 shows that the empty body comes through as |
Verified the behavior is a bug within |
thanks for the help! |
See https://github.com/expressjs/body-parser/blob/master/lib/types/text.js#L51
Would expect it to read
req.body = req.body || ''
instead ofreq.body = req.body || {}
With this line, req.body will return an object when no body is provided
The text was updated successfully, but these errors were encountered: