Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renamed maxFieldSize to maxFieldsSize

  • Loading branch information...
commit 9f970b761aff962350b6bf0e04934ea1dedffbbe 1 parent 52e0ea9
@felixge authored
View
2  Readme.md
@@ -85,7 +85,7 @@ If you want the files written to `incomingForm.uploadDir` to include the extensi
Either 'multipart' or 'urlencoded' depending on the incoming request.
-#### incomingForm.maxFieldSize = 2 * 1024 * 1024
+#### incomingForm.maxFieldsSize = 2 * 1024 * 1024
Limits the amount of memory a field (not file) can allocate in bytes.
I this value is exceeded, an `'error'` event is emitted. The default
View
6 lib/formidable/incoming_form.js
@@ -14,7 +14,7 @@ function IncomingForm() {
this.error = null;
this.ended = false;
- this.maxFieldSize = 2 * 1024 * 1024;
+ this.maxFieldsSize = 2 * 1024 * 1024;
this.keepExtensions = false;
this.uploadDir = '/tmp';
this.encoding = 'utf-8';
@@ -149,8 +149,8 @@ IncomingForm.prototype.handlePart = function(part) {
part.addListener('data', function(buffer) {
self._fieldsSize += buffer.length;
- if (self._fieldsSize > self.maxFieldSize) {
- self._error(new Error('maxFieldSize exceeded, received '+self._fieldsSize+' bytes of field data'));
+ if (self._fieldsSize > self.maxFieldsSize) {
+ self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data'));
return;
}
value += decoder.write(buffer);
View
6 test/simple/test-incoming-form.js
@@ -31,7 +31,7 @@ test(function constructor() {
assert.strictEqual(form.encoding, 'utf-8');
assert.strictEqual(form.bytesReceived, null);
assert.strictEqual(form.bytesExpected, null);
- assert.strictEqual(form.maxFieldSize, 2 * 1024 * 1024);
+ assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024);
assert.strictEqual(form._parser, null);
assert.strictEqual(form._flushing, 0);
assert.strictEqual(form._fieldsSize, 0);
@@ -553,12 +553,12 @@ test(function handlePart() {
})();
(function testFieldSize() {
- form.maxFieldSize = 8;
+ form.maxFieldsSize = 8;
var PART = new events.EventEmitter();
PART.name = 'my_field';
gently.expect(form, '_error', function(err) {
- assert.equal(err.message, 'maxFieldSize exceeded, received 9 bytes of field data');
+ assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data');
});
form.handlePart(PART);
Please sign in to comment.
Something went wrong with that request. Please try again.