mach
mach copied to clipboard
mach.gzip only compresses text/js/json?
Is there a reason that mach.gzip only compresses text/js/json responses? What about media such as images, or other text formats, such as XML (yeah yeah, I know, but it could happen...)?
Is there a reason that mach.gzip only compresses text/js/json responses?
Not really. We should probably loosen up the test regex to let it accept more types. I haven't spent a lot of time thinking about it, honestly.
We should also probably let mach.gzip
accept a test
function as an option so people can override the default test, e.g.
app.use(mach.gzip, {
test: function (conn) {
return true;
}
});
Related: http://stackoverflow.com/questions/20206771/express-with-node-js-not-compressing-jpeg-images
@mjackson cool, I'll take a look at tweaking this and submit a PR soon. Good SO find too.