mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Remove double to string convertion in FormData
Summary:These convertions introduced by 2 different PRs5061fde317de392b5351Closes 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:
committed by
Facebook Github Bot 0
parent
97696b61c8
commit
9e78a63f84
@@ -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};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user