Catalyst-Plugin-Compress
view release on metacpan or search on metacpan
use utf8;
use warnings;
use strict;
use Test::More;
use Encode 2.21 'decode_utf8', 'encode_utf8';
use HTTP::Request::Common;
use Compress::Zlib;
{
package MyApp::Controller::Root;
$INC{'MyApp/Controller/Root.pm'} = __FILE__;
use base 'Catalyst::Controller';
sub heart :Path('â¥') {
my ($self, $c) = @_;
$c->response->content_type('text/html');
$c->response->body("<p>This is path-heart action â¥</p>");
}
package MyApp;
use Catalyst 'Compress';
MyApp->config(compression_format => 'gzip');
MyApp->setup;
}
use Catalyst::Test 'MyApp';
if(MyApp->can('encoding') and MyApp->can('clear_encoding') ) {
ok my $res = request GET '/root/â¥', 'Accept-Encoding' => 'gzip';
is $res->code, 200, 'OK';
ok my $gunzip = Compress::Zlib::memGunzip($res->content);
is decode_utf8($gunzip), "<p>This is path-heart action â¥</p>", 'correct body';
is $res->content_charset, 'UTF-8';
} else {
ok 1, 'Skipping the UTF8 Tests for older installed catalyst';
}
done_testing;
( run in 1.191 second using v1.01-cache-2.11-cpan-39bf76dae61 )