Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response status is unmodified by exceptions in middleware #470

Closed
steventux opened this issue May 26, 2020 · 1 comment
Closed

Response status is unmodified by exceptions in middleware #470

steventux opened this issue May 26, 2020 · 1 comment

Comments

@steventux
Copy link
Contributor

steventux commented May 26, 2020

When an exception occurs in PDFKit middleware the response status does not reflect this.

https://github.com/pdfkit/pdfkit/blob/master/lib/pdfkit/middleware.rb#L20-L53

We discovered this issue recently, our specs test the response code of a PDF generating path, but a mis-configuration of our application middleware(s) meant the response body was compressed before PDFKit attempted to transform it. This resulted in an application error but the response status code was 200.

This PR #469 attempts to remedy this by returning a 500 response status code if exceptions are encountered when transforming the response into PDF.

@github-actions
Copy link

This issue has been marked as stale and will be automatically closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant