Subject: | Compression ignored for content type application/json |
Catalyst::Plugin::Compress does not apply compression to json content. JSON content served
through Catalyst::View::JSON has a content_type of 'application/json' for all browsers except
Opera.
The filter on line 76 needs to be updated to account for this content type.
I've attached a patch that should allow JSON content to be compressed.
Subject: | compress.patch |
--- Catalyst-Plugin-Compress-0.002/lib/Catalyst/Plugin/Compress.pm 2009-04-20 09:38:59.000000000 -0600
+++ Catalyst-Plugin-Compress-0.003/lib/Catalyst/Plugin/Compress.pm 2009-05-20 15:24:45.000000000 -0600
@@ -73,7 +73,7 @@
or $c->res->content_encoding
or (not $c->res->body)
or ($c->res->status != 200)
- or ($c->res->content_type !~ /^text|xml$|javascript$/)
+ or ($c->res->content_type !~ /^text|xml$|javascript|json$/)
) {
return $c->maybe::next::method(@_);
}