Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nesting

  • Loading branch information...
commit 9717ceeb0d5de1fe35c5855d797f53c2ebf91b57 1 parent 4b67e22
@tj tj authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/middleware/bodyParser.js
View
8 lib/middleware/bodyParser.js
@@ -118,10 +118,11 @@ exports.parse['application/json'] = function(req, fn){
exports.parse['multipart/form-data'] = function(req, fn){
var form = new formidable.IncomingForm
+ , query = []
, body = {};
form.on('field', function(name, val){
- body[name] = val;
+ query.push(name + '=' + val);
});
form.on('file', function(){
@@ -131,8 +132,9 @@ exports.parse['multipart/form-data'] = function(req, fn){
form.on('error', fn);
form.on('end', function(){
- console.log(body);
- req.body = body;
+ query = query.join('&');
+ query = qs.parse(query);
+ req.body = query;
fn();
});
Please sign in to comment.
Something went wrong with that request. Please try again.