diff options
author | Eric Wong <e@yhbt.net> | 2020-07-05 23:27:23 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-07-06 20:01:15 +0000 |
commit | 967f6d1b1626392ee4340ea356a00651462377b3 (patch) | |
tree | 2cac0aebec65b9ff343e48a78f3d58d7a1958f6f /t/www_listing.t | |
parent | dda6cc91f8fbaaac187366957be6b828496e12f8 (diff) | |
download | public-inbox-967f6d1b1626392ee4340ea356a00651462377b3.tar.gz |
The changes to GzipFilter here may be beneficial for building HTML and XML responses in other places, too.
Diffstat (limited to 't/www_listing.t')
-rw-r--r-- | t/www_listing.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/www_listing.t b/t/www_listing.t index 0aededd4..c4511cd1 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -35,13 +35,19 @@ like(PublicInbox::WwwListing::fingerprint($bare), qr/\A[a-f0-9]{40}\z/, sub tiny_test { my ($json, $host, $port) = @_; + my $tmp; my $http = HTTP::Tiny->new; my $res = $http->get("http://$host:$port/"); is($res->{status}, 200, 'got HTML listing'); like($res->{content}, qr!</html>!si, 'listing looks like HTML'); + + $res = $http->get("http://$host:$port/", {'Accept-Encoding'=>'gzip'}); + is($res->{status}, 200, 'got gzipped HTML listing'); + IO::Uncompress::Gunzip::gunzip(\(delete $res->{content}) => \$tmp); + like($tmp, qr!</html>!si, 'unzipped listing looks like HTML'); + $res = $http->get("http://$host:$port/manifest.js.gz"); is($res->{status}, 200, 'got manifest'); - my $tmp; IO::Uncompress::Gunzip::gunzip(\(delete $res->{content}) => \$tmp); unlike($tmp, qr/"modified":\s*"/, 'modified is an integer'); my $manifest = $json->decode($tmp); |