There's other potential improvements here such as only compressing the response content if the length is over a certain size. I haven't worked out how to do it yet though.