changeset 116:c8341d95297e

Tests: add some HEAD gzip tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 01 Dec 2009 19:38:22 +0300
parents cb1b04d8de29
children f2b8d86438ee
files gzip.t
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gzip.t
+++ b/gzip.t
@@ -21,7 +21,7 @@ use Test::Nginx qw/ :DEFAULT :gzip /;
 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('/'), qr/Accept
 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
+}
+
+###############################################################################