Range Request (Resume Download)
Implement partial file download using Range headers. This enables resume functionality for interrupted downloads.
🔗 Endpoint
GET /api/v1/files/download?format=large&size=1Open in browser ↗💡 Tips
- ✓Use Range header: bytes=0-1023
- ✓Check for 206 Partial Content status
- ✓Verify Content-Range header format
- ✓Combine chunks to reconstruct full file
💻 Code Example
// Playwright: Range request for partial download
// First, get file size
const headResponse = await request.head('/api/v1/files/download?format=large&size=1');
const totalSize = parseInt(headResponse.headers()['content-length']);
// Download first 1KB
const response = await request.get('/api/v1/files/download?format=large&size=1', {
headers: { 'Range': 'bytes=0-1023' }
});
expect(response.status()).toBe(206);
expect(response.headers()['content-range']).toMatch(/bytes 0-1023\/\d+/);
const chunk = await response.body();
expect(chunk.length).toBe(1024);
// Download next chunk
const response2 = await request.get('/api/v1/files/download?format=large&size=1', {
headers: { 'Range': 'bytes=1024-2047' }
});
expect(response2.status()).toBe(206);🖥️ curl Command
curl -H "Range: bytes=0-1023" /api/v1/files/download?format=large&size=1