-
Notifications
You must be signed in to change notification settings - Fork 27
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-parser needs to be a dependency. #2
base: master
Are you sure you want to change the base?
Conversation
@vangorra what happens if already there is one body parser before? |
An error saying cannot read property token of undefined. |
So, maybe you should check if a body parser exists or turn this optional, right? |
Optional, no. The README for node-oauth2-server demonstrates that the npm body-parser package is required. The existing source for this package doesn't include it. |
If some user is trying to put this package as a middleware that already have the body parser implemented he will have 2 body parsers trying to parse the same body. The question is, if we have 2 body parsers trying to decode an url encoded body what will happen? |
In this case, it doesn't looks like it will matter considering the body parser is being attached to the "app" which is a new instance of express. So the body parsing would be isolated to the routing the "app" variable handles. |
Yes, but think about something like: var bodyParser = Npm.require('body-parser');
WebApp.rawConnectHandlers.use(bodyParser.urlencoded({ extended: false}))
WebApp.rawConnectHandlers.use(oauth2server.app); Will decode the body 2 times. I'm saying that because you can attach this package to another libraries like |
Hmm.. I see your concern. Time to re-evaluate the problem: |
The node-oauth2-server https://github.com/thomseddon/node-oauth2-server/pull/203?ts=2 project is being refactored to remove the express dependency, so we can improve that in the future, now this solve our main problems. |
wow, this is old! do you guys have something new to say? or may I close this? |
|
Adding body-parser as a dependency and configuring it. Also untracking .npm directory, which really shouldn't be tracked.