Skip to content

Commit

Permalink
fixed bug with content-type being undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynos committed Jul 17, 2012
1 parent 4c6bdbd commit 5825681
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Expand Up @@ -19,7 +19,8 @@ function Body(options) {
} }


function formBody(req, res, callback) { function formBody(req, res, callback) {
if (!req.headers['content-type'].match(isForm)) { var contentType = req.headers['content-type'] || ""
if (!contentType.match(isForm)) {
// XXX Add support for formidable uploading, as well // XXX Add support for formidable uploading, as well
return errorPage(req, res, 415) return errorPage(req, res, 415)
} }
Expand All @@ -31,7 +32,8 @@ function Body(options) {
} }


function jsonBody(req, res, callback) { function jsonBody(req, res, callback) {
if (!req.headers["content-type"].match(isJSON)) { var contentType = req.headers['content-type'] || ""
if (!contentType.match(isJSON)) {
return errorPage(req, res, 415) return errorPage(req, res, 415)
} }
body(req, extractJSON) body(req, extractJSON)
Expand Down

0 comments on commit 5825681

Please sign in to comment.