webmachine-ruby icon indicating copy to clipboard operation
webmachine-ruby copied to clipboard

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

Open jimvm opened this issue 9 years ago • 3 comments

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...

jimvm avatar Oct 11 '15 15:10 jimvm

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.

seancribbs avatar Oct 11 '15 17:10 seancribbs

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 avatar Oct 11 '15 19:10 jimvm

@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.

seancribbs avatar Oct 12 '15 00:10 seancribbs