octet-stream / form-data

Spec-compliant FormData implementation for Node.js
https://www.npmjs.com/package/formdata-node
MIT License
142 stars 17 forks source link

Can't append a Blob without a filename #13

Closed jaydenseric closed 4 years ago

jaydenseric commented 4 years ago

It should be possible to .append() a Blob instance to a FormData instance, without having to provide a third filename argument:

The default filename for Blob objects is "blob". — https://developer.mozilla.org/en-US/docs/Web/API/FormData/append

This line assumes a filename exists:

https://github.com/octet-stream/form-data/blob/73d5f4dbffab6f6a27f26c6611e32662c98c2891/src/lib/FormData.mjs#L264

Which causes a Node.js path.basename() error:

The "path" argument must be of type string. Received undefined
octet-stream commented 4 years ago

Hi! Thank you for the feedback. I will take a look and fix it as soon as I can.

octet-stream commented 4 years ago

This should be fixed in v2.1.1