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:
Oleg Lokhvitsky 2016-01-08 11:41:30 -08:00 committed by facebook-github-bot-7
parent 8604bd1812
commit de392b5351
1 changed files with 5 additions and 0 deletions

View File

@ -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') {