about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-05 23:27:27 +0000
committerEric Wong <e@yhbt.net>2020-07-06 20:01:15 +0000
commit2bb3b3491416232a44ad8b318537c856cff727f4 (patch)
treeaca8eb1c7a532d19727209dda335a8b2b5e8f552 /t
parentc2ae55ff47069952ac181111e83e550d7ff3c710 (diff)
downloadpublic-inbox-2bb3b3491416232a44ad8b318537c856cff727f4.tar.gz
This will allow others to mimic our award-winning homepage
design without needing to rely on Plack::Middleware::Deflater
or varnish to compress responses.
Diffstat (limited to 't')
-rw-r--r--t/www_static.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/www_static.t b/t/www_static.t
index 10757cb7..364b9447 100644
--- a/t/www_static.t
+++ b/t/www_static.t
@@ -6,7 +6,7 @@ use Test::More;
 use PublicInbox::TestCommon;
 my ($tmpdir, $for_destroy) = tmpdir();
 my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape);
-require_mods(@mods);
+require_mods(@mods, 'IO::Uncompress::Gunzip');
 use_ok $_ foreach @mods;
 use_ok 'PublicInbox::WwwStatic';
 
@@ -91,6 +91,15 @@ test_psgi($app->(autoindex => 1, index => []), sub {
         $get->header('Accept-Encoding' => 'gzip');
         $res = $cb->($get);
         is($res->content, "hi", 'got compressed on mtime match');
+
+        $get = GET('/dir/');
+        $get->header('Accept-Encoding' => 'gzip');
+        $res = $cb->($get);
+        my $in = $res->content;
+        my $out = '';
+        IO::Uncompress::Gunzip::gunzip(\$in => \$out);
+        like($out, qr/\A<html>/, 'got HTML start after gunzip');
+        like($out, qr{</html>$}, 'got HTML end after gunzip');
 });
 
 done_testing();