'use strict';
var bodyParser = require('body-parser');
var csv = require('csv');

module.exports = function (options, parseOptions) {
  var textOptions = Object.create({}, options);
  textOptions.type = 'text/csv';
  var textMiddleware = bodyParser.text(textOptions);

  return function (req, res, next) {
    if (req.get('content-type') !== 'text/csv') {
      next();
    }

    textMiddleware(req, res, function (err) {
      if (err || Object.prototype.toString.call(req.body) !== '[object String]') {
        return next(err);
      }

      csv.parse(req.body, parseOptions || {}, function(err, parsed) {
        if (err) {
          return next(err);
        }
        req.body = parsed;
        next();
      });
    });
  };
};

@@ -75,16 +75,48 @@
 csv');%0A%0A
+var DEFAULT_TYPE = 'text/csv';%0A%0A
 module.e
@@ -228,26 +228,44 @@
 .type = 
-'text/csv'
+options.type %7C%7C DEFAULT_TYPE
 ;%0A  var 
@@ -312,16 +312,16 @@
 ions);%0A%0A
+
   return
@@ -353,79 +353,8 @@
 ) %7B%0A
-    if (req.get('content-type') !== 'text/csv') %7B%0A      next();%0A    %7D%0A%0A
     

Allow custom type option