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.56k stars 1.33k forks source link

Bug in 7.1.1: adding request.field() fails if value is not Blob #1680

Closed schnuet closed 2 years ago

schnuet commented 2 years ago

Trying to add a field to a request (request.field('keyname', 'fielddata');) fails in 7.1.1 on Google Chrome and generates the following error:

failed to execute 'append' on 'formdata': parameter 2 is not of type 'blob'.

Culprit seems to be this line: https://github.com/visionmedia/superagent/blob/84206c75214e20bbc688d0645880696ecd773c27/src/request-base.js#L463

Calling FormData.append(name, value, options); does not seem to work if value is not a Blob and options is undefined. The options parameter has to be omitted.

scoumbourdis commented 2 years ago

I had the same issue and I've downgraded to 7.0.2 as a work-around for now

niftylettuce commented 2 years ago

Can we get a PR to fix this?

lucas-mancini commented 2 years ago

I still can experience the same bug in latest version, v7.1.1. Is there a workaround or a fix planned?

tkubicek3 commented 2 years ago

Any news?

ltxhhz commented 2 years ago

@niftylettuce Hi, I've fixed the bug and hope to merge branches soon, thank you!🎉

titanism commented 2 years ago

Released in v7.1.4 to npm, thank you @ltxhhz

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