Skip to content
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

Make bodyParser ignore the Content-Type if no body is present #693

Merged
merged 1 commit into from Nov 14, 2012

Conversation

gmethvin
Copy link
Contributor

Add a utils.hasBody(req) function to check for Content-Length or
Transfer-Encoding in the request headers to see if a body exists. Use
this in the middleware to prevent parsing a body in case a client
sends a Content-Type header with no body.

@tj
Copy link
Member

tj commented Nov 14, 2012

if we do implement this it shouldn't be in the mime() util, a simple hasBody(req) or similar util would do

@gmethvin
Copy link
Contributor Author

Okay. Updated to add a hasBody. I assumed you wanted to follow the same convention you have in the multipart middleware for ignoring GETs, where you return an empty object.

Add a utils.hasBody(req) function to check for Content-Length or
Transfer-Encoding in the request headers to see if a body exists. Use
this in the middleware to prevent parsing a body in case a client
sends a Content-Type header with no body.
tj added a commit that referenced this pull request Nov 14, 2012
Make bodyParser ignore the Content-Type if no body is present
@tj tj merged commit 59b668d into senchalabs:master Nov 14, 2012
@acrodrig
Copy link

acrodrig commented Dec 3, 2012

Hi, I am new to GitHub/Node and I am trying to figure out the best option to ask a question about connect (static middleware, getting a hold of the path of the served file ). Sorry if this is not the forum or the right way to do it, could somebody point me in the right direction? Thanks much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants