Permalink
Browse files

remove limit default from `multipart()`

  • Loading branch information...
tj committed Jul 25, 2012
1 parent 997c21e commit a46d66a527de0af20e6fd0270beb4e97cb336192
Showing with 15 additions and 4 deletions.
  1. +13 −2 lib/middleware/multipart.js
  2. +1 −1 test/multipart.js
  3. +1 −1 test/shared/index.js
@@ -15,6 +15,14 @@ var formidable = require('formidable')
, utils = require('../utils')
, qs = require('qs');
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
/**
* Multipart:
*
@@ -32,7 +40,7 @@ var formidable = require('formidable')
*
* Options:
*
- * - `limit` byte limit defaulting to "1mb"
+ * - `limit` byte limit defaulting to none
*
* @param {Object} options
* @return {Function}
@@ -41,7 +49,10 @@ var formidable = require('formidable')
exports = module.exports = function(options){
options = options || {};
- var limit = _limit(options.limit || '20mb');
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
return function multipart(req, res, next) {
if (req._body) return next();
View
@@ -4,7 +4,7 @@ var connect = require('../')
var app = connect();
-app.use(connect.multipart());
+app.use(connect.multipart({ limit: '20mb' }));
app.use(function(req, res){
res.end(JSON.stringify(req.body));
View
@@ -13,7 +13,7 @@ exports['default request body'] = function(app){
};
exports['limit body to'] = function(size, type, app){
- it('should limit body to ' + size, function(done){
+ it('should accept a limit option', function(done){
app.request()
.post('/')
.set('Content-Length', bytes(size) + 1)

0 comments on commit a46d66a

Please sign in to comment.