Chunked Transfer Encoding
Handle Transfer-Encoding: chunked responses where Content-Length is not known in advance.
🔗 Endpoint
GET /api/v1/files/download?format=streamOpen in browser ↗💡 Tips
- ✓Chunked responses have no Content-Length
- ✓Each chunk starts with size in hex
- ✓Final chunk has size 0
- ✓Use streaming APIs to process chunks
💻 Code Example
// Playwright: Handle chunked transfer
const response = await request.get('/api/v1/files/download?format=stream');
// Note: Content-Length may be absent for chunked encoding
expect(response.headers()['transfer-encoding']).toBe('chunked');
// Collect all chunks
const chunks: string[] = [];
const body = await response.text();
// Body contains all chunks concatenated
const lines = body.trim().split('\n');
expect(lines.length).toBe(10); // 10 chunks
lines.forEach((line, i) => {
expect(line).toContain(`Chunk ${i + 1}`);
});🖥️ curl Command
curl -O "https://api.qa-practice.dev/api/v1/files/download?format=stream"