compress = true ignored when below treshold
jesperp opened this issue · 5 comments
jesperp commented
Although docs says
You can always enable compression by setting this.compress = true
Mistake in docs or code? :)
jonathanong commented
It should ignore threshold. Does it not?
jesperp commented
no, this.compress is not checked
if (threshold && this.response.length < threshold) return
Fishrock123 commented
@jesperp see https://github.com/koajs/compress/blob/master/index.js#L55
and https://github.com/koajs/compress/blob/master/index.js#L44
this.compress
does not force compression below the threshold. It merely bypasses the filter, or enables on a file-by-file level.
jesperp commented
gotcha
Fishrock123 commented
@jesperp Apologies, let me correct myself, that should have been below the threshold.
i.e. the threshold is for files that are too small to bother with.