Permalink
Browse files

fixed bug with content-type being undefined

  • Loading branch information...
1 parent 4c6bdbd commit 5825681d50b132c4baf51a90ef8567b8923caa26 @Raynos committed Jul 17, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 index.js
View
@@ -19,7 +19,8 @@ function Body(options) {
}
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
return errorPage(req, res, 415)
}
@@ -31,7 +32,8 @@ function Body(options) {
}
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)
}
body(req, extractJSON)

0 comments on commit 5825681

Please sign in to comment.