Skip to main content

Download PDF Document

Download a PDF file and verify its size, Content-Disposition header, and basic PDF structure.

MEDIUM

🔗 Endpoint

GET /api/v1/files/download?format=pdf&rows=10Open in browser ↗

💡 Tips

  • Check Content-Type is application/pdf
  • Verify PDF magic bytes (%PDF-)
  • Check Content-Length header
  • For full PDF parsing, use pdf-parse library

💻 Code Example

// Playwright: Download and verify PDF
const response = await request.get('/api/v1/files/download?format=pdf');

expect(response.headers()['content-type']).toBe('application/pdf');
expect(response.headers()['content-disposition']).toContain('report.pdf');

// Get binary content
const buffer = await response.body();
expect(buffer.length).toBeGreaterThan(0);

// Check PDF magic bytes
const header = buffer.slice(0, 5).toString();
expect(header).toBe('%PDF-');

🖥️ curl Command

curl -O "https://api.qa-practice.dev/api/v1/files/download?format=pdf&rows=10"