Download CSV File
Download a CSV file and verify its Content-Type header and data structure. Learn to parse CSV and validate the content.
🔗 Endpoint
GET /api/v1/files/download?format=csv&rows=10&type=usersOpen in browser ↗💡 Tips
- ✓Check Content-Type is text/csv
- ✓Verify Content-Disposition contains filename
- ✓Parse CSV and validate header row
- ✓Check that data rows match expected count
💻 Code Example
// Playwright: Download and verify CSV
const response = await request.get('/api/v1/files/download?format=csv&rows=10');
// Check headers
expect(response.headers()['content-type']).toContain('text/csv');
expect(response.headers()['content-disposition']).toContain('filename=');
// Parse CSV
const csv = await response.text();
const lines = csv.trim().split('\n');
expect(lines[0]).toBe('id,name,email,role,createdAt');
expect(lines.length).toBe(11); // header + 10 rows🖥️ curl Command
curl -O "https://api.qa-practice.dev/api/v1/files/download?format=csv&rows=10&type=users"