Skip to content

Commit 6035eb9

Browse files
committed
fix: use empty prototype
1 parent cc203ca commit 6035eb9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Formidable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ class IncomingForm extends EventEmitter {
202202
}
203203
}
204204
const callback = once(dezalgo(cb));
205-
this.fields = {};
206-
const files = {};
205+
this.fields = Object.create(null);
206+
const files = Object.create(null);
207207

208208
this.on('field', (name, value) => {
209209
if (this.type === 'multipart' || this.type === 'urlencoded') {

src/plugins/json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function init(_self, _opts) {
2727
const parser = new JSONParser(this.options);
2828

2929
parser.on('data', (fields) => {
30-
this.fields = fields;
30+
this.fields = Object.assign(Object.create(null), fields);
3131
});
3232

3333
parser.once('end', () => {

0 commit comments

Comments
 (0)