cuckoosandbox / community

Repository of modules and signatures contributed by the community
324 stars 175 forks source link

Unable to invoke POST request of /tasks/create/submit in NodeJs #506

Open meetrajsinh-crest opened 3 years ago

meetrajsinh-crest commented 3 years ago

Hello Team,

I am trying to invoke the POST request of /tasks/create/submit in NodeJs with files parameter and also attaching the file, but unable to get the task-ids, though i can get the 200 status code and also get the submit id.

var request = require('request');
var fs = require('fs');
var options = {
  'method': 'POST',
  'url': 'http://localhost:8090/tasks/create/submit',
  'headers': {
    'Content-Type': 'multipart/form-data',
    'Authorization': 'Bearer SAMPL3'
  },
  formData: {
    'files': {
      'value': fs.createReadStream('/root/testingfile.txt'),
      'options': {
        'filename': '/root/testingfile.txt',
        'contentType': null
      }
    }
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Can someone help me out?

Note: When I hit the curl command with files parameter it gives expected output with task-ids and submit id. And also it does not give proper output in Postman as well.