Compression is applied to already compressed responses
mpdn opened this issue · comments
If a request has an Accept-Encoding
header and the route itself responds with a compressed response with Content-Encoding
set, restful will try to compress the response again, resulting in an invalid response body with two Content-Encoding
headers.
Compression should probably only be applied if there is no Content-Encoding
header in the response from the route.
hi, thank you for reporting this. I can remember solving a similar reported problem. I will have a look at it again.
what value of accept-encoding are you sending? See for the checks:
Line 86 in 4888f8b
I am using gzip
and the route I have responds with compressed content with a content-encoding: gzip
header set as well.
So your response already has compressed content and the package should check the response header too to prevent the duplication?
Yes, exactly. Otherwise you end up gzipping the response twice.
Though I guess if if compressing it once is good then twice must be better. 😆
Edit: My application proxies a response from another service, which is why it responds with an already compressed response, by the way. No need to decompress and recompress the response again.
@mpdn can you verify the change in the PR?