Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Projects
None yet
3 participants
Contributor

gmethvin commented Nov 14, 2012

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.

@gmethvin gmethvin referenced this pull request in expressjs/express Nov 14, 2012

Closed

Error with connect middleware for GET with contentType #1416

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

Contributor

gmethvin commented Nov 14, 2012

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.

Make bodyParser ignore the Content-Type if no body is present
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

Merge pull request #693 from gmethvin/master
Make bodyParser ignore the Content-Type if no body is present

@tj tj merged commit 59b668d into senchalabs:master Nov 14, 2012

1 check passed

default The Travis build passed
Details

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