Permalink
Browse files

remove limit default from `urlencoded()`

  • Loading branch information...
1 parent 4353444 commit 988021448af8268ae4062f45eb800bdb1789dcc0 @tj tj committed Jul 25, 2012
Showing with 14 additions and 3 deletions.
  1. +13 −2 lib/middleware/urlencoded.js
  2. +1 −1 test/urlencoded.js
@@ -15,14 +15,22 @@ var utils = require('../utils')
, qs = require('qs');
/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
* Urlencoded:
*
* Parse x-ww-form-urlencoded request bodies,
* providing the parsed object as `req.body`.
*
* Options:
*
- * - `limit` byte limit defaulting to "1mb"
+ * - `limit` byte limit disabled by default
*
* @param {Object} options
* @return {Function}
@@ -31,7 +39,10 @@ var utils = require('../utils')
exports = module.exports = function(options){
options = options || {};
- var limit = _limit(options.limit || '1mb');
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
return function urlencoded(req, res, next) {
if (req._body) return next();
View
@@ -4,7 +4,7 @@ var connect = require('../')
var app = connect();
-app.use(connect.urlencoded());
+app.use(connect.urlencoded({ limit: '1mb' }));
app.use(function(req, res){
res.end(JSON.stringify(req.body));

0 comments on commit 9880214

Please sign in to comment.