Permalink
Browse files

Posts with no content type shouldn't bomb

  • Loading branch information...
1 parent 29e86f7 commit d0c65788c792a6b72024875973afd232855bf3af Mike Ihbe committed Feb 10, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/app.js
View
@@ -344,8 +344,9 @@ var App = function () {
// If it's a plain form-post, save the request-body, and parse it into
// params as well
if ((req.method == 'POST' || req.method == 'PUT') &&
- (req.headers['content-type'].indexOf('form-urlencoded') > -1 ||
- req.headers['content-type'].indexOf('application/json') > -1)) {
+ (req.headers['content-type'] &&
+ (req.headers['content-type'].indexOf('form-urlencoded') > -1 ||
+ req.headers['content-type'].indexOf('application/json') > -1))) {
req.addListener('data', function (data) {
body += data.toString();
});

0 comments on commit d0c6578

Please sign in to comment.