Remove double to string convertion in FormData

Summary:These convertions introduced by 2 different PRs
5061fde317
de392b5351
Closes https://github.com/facebook/react-native/pull/5815

Differential Revision: D3144703

fb-gh-sync-id: a483916bb7387a64d89f809ccfb35ecb9a065b1e
fbshipit-source-id: a483916bb7387a64d89f809ccfb35ecb9a065b1e
This commit is contained in:
Aleksei Androsov
2016-04-06 09:00:43 -07:00
committed by Facebook Github Bot 0
parent 97696b61c8
commit 9e78a63f84

View File

@@ -64,10 +64,6 @@ 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};
@@ -85,7 +81,7 @@ class FormData {
}
return {...value, headers, fieldName: name};
}
// Cast to string all other values
// Convert non-object values to strings as per FormData.append() spec
return {string: String(value), headers, fieldName: name};
});
}