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

Fix precedence - user defined name for stream has higher precedence #28

Closed wheelly closed 3 years ago

wheelly commented 3 years ago

Bug: got a file in stream from mutler which saves the file in tmp directory. ReadableStream has path property that has a filename that I don't want to see in the request because I specify third parameter to formData.append function.

octet-stream commented 3 years ago

Hi, thanks for the PR. Yeah, it seems like this will match browsers behaviour when you set a File as a field's value. But I think it has to be fixed for Blob and File too.

octet-stream commented 3 years ago

I found a bigger problem here: my library, unlike the browsers implementations, returns the same File instance I put into it. Browsers return a new file instance when I call form.get method. Your fix also applies to Blob and File. I think I'll fix all of that by myself. Thanks.

Also, it's a good practice to make all of your changes in a different branch when you want to make a PR. Please, don't use the main branch for that. Perhaps I need to add contribution guidelines and mention that.