Permalink
Browse files

Fixed; do not assume content-type is present [reported by c4milo]

  • Loading branch information...
1 parent 0cf2aee commit 3ea89775f5ba3fa541371e5bf77a9df4ac836e20 @tj tj committed Mar 25, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/connect-form.js
View
6 lib/connect-form.js
@@ -73,11 +73,13 @@ module.exports = function(options){
*/
function formRequest(req) {
+ var contentType = req.headers['content-type'];
+ if (!contentType) return;
return req.body === undefined
&& (req.method === 'POST'
|| req.method === 'PUT')
- && (~req.headers['content-type'].indexOf('multipart/form-data')
- || ~req.headers['content-type'].indexOf('urlencoded'));
+ && (~contentType.indexOf('multipart/form-data')
+ || ~contentType.indexOf('urlencoded'));
}
/**

0 comments on commit 3ea8977

Please sign in to comment.