Skip to content

Commit 5711320

Browse files
committed
Add similar type error as the browser for attempting to use form-data without new.
1 parent 7200b2c commit 5711320

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/form_data.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ var async = require('async');
1010

1111
module.exports = FormData;
1212
function FormData() {
13+
if (!(this instanceof FormData)) {
14+
throw new TypeError("Failed to construct 'FormData': Please use the 'new' operator, this object constructor cannot be called as a function.")
15+
}
16+
1317
this._overheadLength = 0;
1418
this._valueLength = 0;
1519
this._lengthRetrievers = [];

0 commit comments

Comments
 (0)