We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8180a19 commit f80e147Copy full SHA for f80e147
lib/request-base.js
@@ -3,8 +3,6 @@
3
*/
4
var isObject = require('./is-object');
5
6
-var FormData = require('form-data'); // browserify compatible
7
-
8
/**
9
* Clear previous timeout.
10
*
@@ -163,7 +161,10 @@ exports.unset = function(field){
163
161
* @api public
164
162
165
exports.field = function(name, val) {
166
- if (!this._formData) this._formData = new FormData();
+ if (!this._formData) {
+ var FormData = require('form-data'); // browserify compatible. May throw if FormData is not supported natively.
+ this._formData = new FormData();
167
+ }
168
this._formData.append(name, val);
169
return this;
170
};
0 commit comments