-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Currently, array values get serialized as comma-separated strings. This is less than ideal since the only real reason to use FormData over json is to handle files, and servers have a hard time figuring out your binary from strings like "[object Object], [object Object]".
Therefore, please consider changing:
https://github.com/funtusov/ember-cli-form-data/blob/master/addon/mixins/form-data-adapter.js#L18
Ember.keys(data[root]).forEach(function(key) {
if (typeof data[root][key] !== 'undefined') {
formData.append(root + "[" + key + "]", data[root][key]);
}
});to...
Ember.keys(data[root]).forEach(function(key) {
if (Ember.isArray(data[root][key])) {
data[root][key].forEach(function(value) {
formData.append(root + "[" + key + "][]", value);
});
} else if (typeof data[root][key] !== 'undefined') {
formData.append(root + "[" + key + "]", data[root][key]);
}
});If this is something we're interested in doing, please let me know and I will submit a PR after I fail my presentation on June 2nd
Metadata
Metadata
Assignees
Labels
No labels