form-backend-validation icon indicating copy to clipboard operation
form-backend-validation copied to clipboard

Inconsistency in formData and json payloads

Open mikemellor11 opened this issue 2 years ago • 0 comments

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?

mikemellor11 avatar May 25 '22 10:05 mikemellor11