expressjs / compression

Node.js compression middleware
MIT License
2.77k stars 241 forks source link

JSON response does not get compressed #65

Closed jadbox closed 9 years ago

jadbox commented 9 years ago

Express 4.13.3 Compression 1.6

app.use(compression); res.json({ foo: 'bar' }); app.listen(80);

The browser reports that the resulting response is not compressed. However, static content being served does get gzip'ed for me.

dougwilson commented 9 years ago

Hi! From the readme (https://github.com/expressjs/compression/blob/master/README.md#threshold) only responses larger than 1kb are compressed by default. Your example there is well below the default threshold limit to compress (and if we did compress that response, it would actually be bigger over the wire than the non compressed response, which is why it is not compressed).

jadbox commented 9 years ago

Okay thanks