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:
1
let formData = frisby.formData();
Copied!
A full usage example might look like this:
1
const csvPath = path.resolve(__dirname, './file.csv');
2
let content = fs.createReadStream(csvPath);
3
let formData = frisby.formData();
4
5
formData.append('file', content);
6
7
return frisby
8
.post('http://api.example.com/files', { body: formData })
9
.inspectRequestHeaders()
10
.expect('status', 200)
Copied!
API and Usage - Previous
Inspectors
Last modified
2yr ago
Copy link