form-backend-validation
form-backend-validation copied to clipboard
Inconsistency in formData and json payloads
Json payload
// Form
form: new Form({
title: undefined,
file: null
});
// Request
this.form.post('/api/post');
// Actual Payload
{
file: null
}
Form data payload
// Form
form: new Form({
title: undefined,
file: File
});
// Request
this.form.post('/api/post');
// Actual Payload
{
title: undefined
file: Binary
}
JSON.stringify is automatically removing undefined properties from the string sent to the server, shouldn't the form data match this?