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

default req.body to {} regardless of content-type #354

Closed
tj opened this Issue Aug 22, 2011 · 4 comments

Comments

Projects
None yet
3 participants
Member

tj commented Aug 22, 2011

perhaps a little misleading since it will look like you may have an appropriate content-type with no body, but it's pretty fragile otherwise, I've seen quite a bit of code including some of my own assuming its presence:

app.post('/foo', function(req, res){
  res.send(req.body.foo);
});

for example will break if you dont post json or x-www-form-urlencoded data

ryanrolds added a commit to ryanrolds/connect that referenced this issue Sep 15, 2011

tj added a commit that referenced this issue Sep 16, 2011

@tj tj closed this Sep 16, 2011

c4milo commented Oct 2, 2011

awesome, I've been having the same issue since a while too.

This change breaks connect-form, which won't do its job unless body === undefined.

Member

tj commented Nov 17, 2011

@pacovell yeah I saw that in connect-form's issues. 1.8.0 adds req.body support for multipart now

Great, will check that out. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment