Fix Network::FormData to support non-string, non-object values
Reviewed By: pvulgaris, nicklockwood Differential Revision: D2805463 fb-gh-sync-id: 30e847760be1fe557497080adb8fa372f19f00c3
This commit is contained in:
parent
8604bd1812
commit
de392b5351
|
@ -64,6 +64,11 @@ class FormData {
|
|||
getParts(): Array<FormDataPart> {
|
||||
return this._parts.map(([name, value]) => {
|
||||
var contentDisposition = 'form-data; name="' + name + '"';
|
||||
// Convert non-object values to strings as per FormData.append() spec
|
||||
if (typeof value !== 'object') {
|
||||
value = '' + value;
|
||||
}
|
||||
|
||||
/* $FlowIssue(>=0.20.1) #9463928 */
|
||||
var headers: Headers = {'content-disposition': contentDisposition};
|
||||
if (typeof value === 'string') {
|
||||
|
|
Loading…
Reference in New Issue