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

Create an error response body outside render_error (issue #144) #232

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jimvm
Copy link
Contributor

@jimvm jimvm commented Oct 11, 2015

In l7 the resource and encodings_provided? is available so encode_body can be used. In this case the standard error response would have to be created outside of render_error though.

This works for gzip but not for deflate...

@seancribbs
Copy link
Member

I think the better solution would be to have render_error properly set the headers. If that means clearing the selected encoding, that would be preferable to reporting the content-length incorrectly.

@jimvm
Copy link
Contributor Author

jimvm commented Oct 11, 2015

I guess I did not understand that correctly.

So the Content-Encoding header should be cleared because the Content-Length header can't be changed there. Even if encodings_provided is set, in case of a 404 Content-Encoding should be clear.

jimvm added 2 commits October 11, 2015 22:34
It is not possible to correctly encode the response in render_error. So it is
better to delete the Content-Encoding header here.
@seancribbs
Copy link
Member

@jimvm I was merely suggesting the most expedient solution, not a hard-and-fast one. Basically, regardless of what the response returns, the content-length needs to take into account the content-encoding, or we're in a lot of trouble.

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

Successfully merging this pull request may close these issues.

2 participants