Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove limit default from `multipart()`

  • Loading branch information...
commit a46d66a527de0af20e6fd0270beb4e97cb336192 1 parent 997c21e
@tj tj authored
View
15 lib/middleware/multipart.js
@@ -16,6 +16,14 @@ var formidable = require('formidable')
, qs = require('qs');
/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
* Multipart:
*
* Parse multipart/form-data request bodies,
@@ -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
2  test/multipart.js
@@ -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
2  test/shared/index.js
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.