How to send form data in post request using oboe.js?

172 views Asked by At

When I try it it throws 500 error and it looks like there is problem with it's request body. It might be problem with configuration in oboe libraries but I haven't changed anything since installation.

asyncMethod(fileToUpload, selectedDate) {
const formData = new FormData();
formData.append(
  'positions',
  new Blob([fileToUpload], {
    type: 'application/octet-stream',
  }),
);
oboe({
  url: `/mct/api/compute/file?streamprogress=1&businessDate=${selectedDate}`,
  body: formData,
  method: 'POST',
  headers: {
    'Content-Type': 'multipart/form-data',
    //'Content-Length': 1262,
    'X-Requested-With': undefined,
  },
})
  .node('!.{percent}', function(data) {
    console.log('--------------------');
    console.log(data);
  })
  .done(function(data) {
    console.log('-------------------DONE---------------------');
    console.log(data);
  })
  .fail(function(data) {
    console.log('-------------------FAIL---------------------');
    console.log(data);
  });

}

Network status

0

There are 0 answers