Tests: add some HEAD gzip tests.
diff --git a/gzip.t b/gzip.t index e4a25e2..a6915fb 100644 --- a/gzip.t +++ b/gzip.t
@@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has('gzip')->plan(6); +my $t = Test::Nginx->new()->has('gzip')->plan(8); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -77,4 +77,22 @@ unlike(http_gzip_request('/proxy/'), qr/Accept-Ranges/im, 'cleared headers from proxy'); +# HEAD requests should return correct headers + +like(http_gzip_head('/'), qr/Content-Encoding: gzip/, 'gzip head'); +unlike(http_head('/'), qr/Content-Encoding: gzip/, 'no gzip head'); + +############################################################################### + +sub http_gzip_head { + my ($uri) = @_; + return http(<<EOF); +HEAD $uri HTTP/1.1 +Host: localhost +Connection: close +Accept-Encoding: gzip + +EOF +} + ###############################################################################