Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[minor] only parse req.body of type string as querystring
  • Loading branch information
Swaagie committed Feb 27, 2014
1 parent 7e4da02 commit 27d4349
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions lib/director/http/index.js
Expand Up @@ -238,13 +238,15 @@ Router.prototype.parse = function (req) {
});
}

try {
req.body = req.body && req.body.length
? parser(req.body)
: {};
}
catch (err) {
return new exports.BadRequest('Malformed data');
if ('string' === typeof req.body) {
try {
req.body = req.body && req.body.length
? parser(req.body)
: {};
}
catch (err) {
return new exports.BadRequest('Malformed data');
}
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "director",
"description": "A client Side/Server Side Router",
"author": "Nodejitsu Inc. <info@nodejitsu.com>",
"version": "1.2.2",
"version": "1.2.3",
"maintainers": [
"hij1nx <paolo@nodejitsu.com>",
"indexzero <charlie@nodejitsu.com>"
Expand Down

0 comments on commit 27d4349

Please sign in to comment.