Skip to content

Commit 8ea22e0

Browse files
committed
chore: tweaks, notes updates
Signed-off-by: Charlike Mike Reagent <[email protected]>
1 parent 26b7640 commit 8ea22e0

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "formidable",
3-
"version": "2.0.0-canary.20200129.3",
3+
"version": "2.0.0-canary.20200129.4",
44
"license": "MIT",
55
"description": "A node.js module for parsing form data, especially file uploads.",
66
"homepage": "https://github.com/node-formidable/node-formidable",

src/Formidable.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,15 @@ class IncomingForm extends EventEmitter {
218218

219219
// This MUST check exactly for undefined. You can not change it to !part.filename.
220220

221+
// todo: uncomment when switch tests to Jest
222+
// console.log(part);
223+
221224
// ? NOTE(@tunnckocore): no it can be any falsey value, it most probably depends on what's returned
222225
// from somewhere else. Where recently I changed the return statements
223226
// and such thing because code style
224227
// ? NOTE(@tunnckocore): or even better, if there is no mime, then it's for sure a field
225-
// ? NOTE(@tunnckocore): filename is an empty string when a field
226-
if ((part.filename !== '' && !part.filename) || !part.mime) {
228+
// ? NOTE(@tunnckocore): filename is an empty string when a field?
229+
if (!part.mime) {
227230
let value = '';
228231
const decoder = new StringDecoder(part.transferEncoding || this.encoding);
229232

test/integration/test-json.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ const formidable = require('../../src/index');
66

77
const testData = {
88
numbers: [1, 2, 3, 4, 5],
9-
nested: { key: 'value' },
9+
nested: { key: 'val' },
1010
};
1111

1212
const PORT = 13532;
1313
const server = http.createServer((req, res) => {
1414
const form = formidable();
1515

1616
form.parse(req, (err, fields) => {
17-
assert.deepEqual(fields, testData);
17+
assert.deepStrictEqual(fields, {
18+
numbers: [1, 2, 3, 4, 5],
19+
nested: { key: 'val' },
20+
});
1821

1922
res.end();
2023
server.close();

0 commit comments

Comments
 (0)