-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
Expose bodyParser.raw on express #3708
Conversation
Can someone stage a PR for the documentarion of this against the expressjs.com repo? That would be a huge help since there is a lot to document here. I can write this up myself as well, though that just means waiting on me :) |
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.
Please add a test somewhere that checks just that it works. This is usually done as an acceptance test.
From what I understand about NPM, it's designed to handle these types of conflicts seamlessly because each dependency can have its own version of a dependency in its tree. If your project is using body-parser itself, it may make more sense to use it as its own dependency instead of depending on Express to expose its methods in the way you need it to, now and in the future. This is probably worth a small increase in the size of your code. |
@LinusU @wesleytodd I'm working to land this in the 4.17 branch now and I thought that This side discussion is not a blocker to landing this in 4.17. I created expressjs/discussions#78 to discuss further. |
c7aa250
to
87ee733
Compare
It's currently not possible to use the
bodyParser.raw
middleware through express. To have it one needs to usebodyParser
directly. But alas, body-parser is not exposed through exports. So it's necessary to add it as a dependency to your project, which is clearly not desired as it might lead to multiple versions ofbody-parser
(see #3706).This PR just adds the
raw
middleware to the exports object, same asjson
andurlencoded
.