diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
commit | c9cf025fadfe043f0f2f679e10d1207d8a158bb6 (patch) | |
tree | 3a94effe0bdc0a6814d8134f4ed840d7cc6b6f19 /debian/perl-framework/t/modules/reflector.t | |
parent | Adding upstream version 2.4.57. (diff) | |
download | apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.tar.xz apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.zip |
Adding debian version 2.4.57-2.debian/2.4.57-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | debian/perl-framework/t/modules/reflector.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/debian/perl-framework/t/modules/reflector.t b/debian/perl-framework/t/modules/reflector.t new file mode 100644 index 0000000..5d5c86b --- /dev/null +++ b/debian/perl-framework/t/modules/reflector.t @@ -0,0 +1,44 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil; +use Apache::TestRequest; + +my @testcases = ( + ['/apache/reflector_nodeflate/', "Text that will not reach the DEFLATE filter"], + ['/apache/reflector_deflate/', "Text that should be gzipped"], +); + +my @headers; +push @headers, "header2reflect" => "1"; +push @headers, "header2update" => "1"; +push @headers, "header2delete" => "1"; +push @headers, "Content-Encoding" => "gzip"; +push @headers, "Accept-Encoding" => "gzip"; + +plan tests => scalar @testcases * 7, need 'mod_reflector', 'mod_deflate'; + +foreach my $t (@testcases) { + my $r = POST($t->[0], @headers, content => $t->[1]); + + # Checking for return code + ok t_cmp($r->code, 200, "Checking return code is '200'"); + + # Checking for content + if (index($t->[0], "_nodeflate") != -1) { + # With no filter, we should receive what we have sent + ok t_is_equal($r->content, $t->[1]); + ok t_cmp($r->header("Content-Encoding"), undef, "'Content-Encoding' has not been added because there was no filter"); + } else { + # With DEFLATE, input should have been updated and 'Content-Encoding' added + ok not t_is_equal($r->content, $t->[1]); + ok t_cmp($r->header("Content-Encoding"), "gzip", "'Content-Encoding' has been added by the DEFLATE filter"); + } + + # Checking for headers + ok t_cmp($r->header("header2reflect"), "1", "'header2reflect' is present"); + ok t_cmp($r->header("header2update"), undef, "'header2update' is absent"); + ok t_cmp($r->header("header2updateUpdated"), "1", "'header2updateUpdated' is present"); + ok t_cmp($r->header("header2delete"), undef, "'header2delete' is absent"); +} |