Skip to content

Commit

Permalink
Fix Network::FormData to support non-string, non-object values
Browse files Browse the repository at this point in the history
Reviewed By: pvulgaris, nicklockwood

Differential Revision: D2805463

fb-gh-sync-id: 30e847760be1fe557497080adb8fa372f19f00c3
  • Loading branch information
olegbl authored and facebook-github-bot-7 committed Jan 8, 2016
1 parent 8604bd1 commit de392b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Libraries/Network/FormData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit de392b5

Please sign in to comment.