File is corrupted if i download it when validateResponse is true
Opened this issue · 2 comments
daemyn commented
I made an api with an endpoint that returns/download a file (application/pdf for now)
But when i download the file and open it it's corrupted, however when i disable validateResponse in swaggerValidator middleware the file will be downloaded perfectly ! it seems like this middleware is altering the response
Is there a way to fix this?
lerit commented
same problem
HanOterLin commented
make sure the header sets:
res.setHeader('Content-Length', file.size);
res.setHeader('Content-Type', 'application/pdf');
res.setHeader('Content-Disposition', 'attachment; filename=file.pdf')
If it still not work, you can try to update your swagger-ui version to 3.0.0+