-
-
Notifications
You must be signed in to change notification settings - Fork 736
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
Body defaults to {}
even if type fn returns false
#146
Comments
I think the expected behavior is that if bodyparser is not parsing anything, nothing should be touched. |
You need to use the 2.x branch until it is released. This issue has already been fixed, but 2.x is not yet complete.
Be aware that the current 2.x line does not yet have all the features of 1.x, as we are working on it. |
You can find a previous answer I gave at #128 (comment) if it helps explain more. I closed this issue because there isn't work to do to fix it, as the work has already been done, just not yet released due to some edge case bugs still being addressed. |
Sounds good, thank you! |
I'm going to work tonight on getting a proper alpha published to npm as well. |
What is the expected behavior if the content type of the request doesn't match the type option in the text parser? I think my expectation is that the parser should do nothing;
req.body
should not be populated and should remainundefined
.However, based on this test and this code it looks like
req.body
gets set to{}
by default.This caused a bug in my application because further down the middleware chain I check for the truthiness of
req.body
, and empty object happens to be truthy.The text was updated successfully, but these errors were encountered: