dougm       2002/06/29 13:39:22

  Added:       t/apache scanhdrs2.t
               t/response/TestApache scanhdrs2.pm
  Log:
  add tests for redirects with PerlOptions +ParseHeaders
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/apache/scanhdrs2.t
  
  Index: scanhdrs2.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests => 5;
  
  my $module = 'TestApache::scanhdrs2';
  my $location = "/$module";
  
  my $redirect = 'http://perl.apache.org/';
  
  my $res = GET "$location?$redirect", redirect_ok => 0;
  
  ok t_cmp($res->header('Location'), $redirect,
           "Location header");
  
  ok t_cmp($res->code, 302,
           "status == 302");
  
  $redirect = '/index.html';
  
  $res = GET "$location?$redirect", redirect_ok => 0;
  
  ok t_cmp(1, !$res->header('Location'),
           "no Location header");
  
  ok t_cmp($res->code, 200,
           "status == 200");
  
  ok t_cmp(qr{welcome to}, $res->content,
           "content is index.html");
  
  
  
  1.1                  modperl-2.0/t/response/TestApache/scanhdrs2.pm
  
  Index: scanhdrs2.pm
  ===================================================================
  package TestApache::scanhdrs2;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  
  use Apache::Const -compile => 'OK';
  
  sub handler {
      my $r = shift;
  
      my $location = $r->args;
  
      print "Location: $location\n\n";
  
      Apache::OK;
  }
  
  1;
  __END__
  SetHandler perl-script
  PerlOptions +ParseHeaders
  
  
  


Reply via email to