F
F
Frisby
Search…
Introduction
Introduction
Frisby.js Overview
Getting Started
API and Usage
HTTP Request Methods
globalSetup() / setup()
Running Assertions
Nested Tests
Inspectors
File Uploads
Powered By
GitBook
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('http://api.example.com/files', { body: formData })
.inspectRequestHeaders()
.expect('status', 200)
API and Usage - Previous
Inspectors
Last modified
2yr ago
Copy link