ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.58k stars 1.33k forks source link

Adding options to pass through form-data #1627

Closed ywadsk closed 2 years ago

ywadsk commented 3 years ago

.field function is missing options to attach binary data. Form-data has the function append(name, value, options) to attach binary data. This change will add an option string (e.g. 'blob') and pass it to form-data, which will allow attaching binary data directly using .field function.

e.g. .field('mydataid', binary_data_buffer, 'blob')

niftylettuce commented 2 years ago

Released in v7.1.0 to npm

https://github.com/visionmedia/superagent/releases/tag/v7.1.0

smhg commented 2 years ago

@ywadsk It would be great to add a test for a PR like this. It doesn't seem to work in, at least, Chrome. See #1680.