Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
tj opened this Issue · 4 comments

3 participants

@tj
Owner
tj commented

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 ryanrolds referenced this issue from a commit in ryanrolds/connect
@ryanrolds ryanrolds Default req.body to {} per #354 ae832c5
@tj tj closed this
@c4milo

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

@pacovell

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

@tj
Owner
tj commented

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

@pacovell

Great, will check that out. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.