File Uploads

Since Frisby.js is based on the Fetch API, file uploads are a cinch with the built-in FormData object (see Using FormData Objects on MDN if you are not familiar with them).

You can get a new FormData object from Frisby:

let formData = frisby.formData();

A full usage example might look like this:

const csvPath = path.resolve(__dirname, './file.csv');
let content = fs.createReadStream(csvPath);
let formData = frisby.formData();

formData.append('file', content);

return frisby
  .post('', { body: formData })
  .expect('status', 200)

Last updated