perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestAPI err_headers_out.pm
Date Sat, 24 Jul 2004 01:08:14 GMT
stas        2004/07/23 18:08:14

  Modified:    t/api    err_headers_out.t
               t/response/TestAPI err_headers_out.pm
  Log:
  test the 2xx response as well
  
  Revision  Changes    Path
  1.2       +30 -7     modperl-2.0/t/api/err_headers_out.t
  
  Index: err_headers_out.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/api/err_headers_out.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- err_headers_out.t	24 Jul 2004 00:54:01 -0000	1.1
  +++ err_headers_out.t	24 Jul 2004 01:08:14 -0000	1.2
  @@ -5,17 +5,40 @@
   use Apache::TestRequest;
   use Apache::TestUtil;
   
  -plan tests => 3;
  +plan tests => 6;
   
   my $location = '/TestAPI__err_headers_out';
   
  -my $res = GET $location;
  +{
  +    # with 2xx responses any of the err_headers_out and headers_out
  +    # headers make it through
   
  -#t_debug $res->as_string;
  +    my $res = GET "$location?200";
   
  -ok t_cmp $res->code, 404, "not found";
  +    #t_debug $res->as_string;
   
  -ok t_cmp $res->header('X-Survivor'), "err_headers_out",
  -    "X-Survivor: made it";
  +    ok t_cmp $res->code, 200, "OK";
  +
  +    ok t_cmp $res->header('X-err_headers_out'), "err_headers_out",
  +        "X-err_headers_out: made it";
  +
  +    ok t_cmp $res->header('X-headers_out'), "headers_out",
  +        "X-headers_out: made it";
  +}
  +
  +{
  +    # with non-2xx responses only the err_headers_out headers make it
  +    # through. the headers_out do not make it.
  +
  +    my $res = GET "$location?404";
  +
  +    #t_debug $res->as_string;
  +
  +    ok t_cmp $res->code, 404, "not found";
  +
  +    ok t_cmp $res->header('X-err_headers_out'), "err_headers_out",
  +        "X-err_headers_out: made it";
  +
  +    ok !$res->header('X-headers_out');
  +}
   
  -ok !$res->header('X-Goner');
  
  
  
  1.2       +5 -5      modperl-2.0/t/response/TestAPI/err_headers_out.pm
  
  Index: err_headers_out.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/err_headers_out.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- err_headers_out.pm	24 Jul 2004 00:54:02 -0000	1.1
  +++ err_headers_out.pm	24 Jul 2004 01:08:14 -0000	1.2
  @@ -17,13 +17,13 @@
   sub handler {
       my $r = shift;
   
  -    # this header will make it
  -    $r->err_headers_out->add('X-Survivor' => "err_headers_out");
  +    # this header will always make it to the client
  +    $r->err_headers_out->add('X-err_headers_out' => "err_headers_out");
   
  -    # this header won't make it
  -    $r->headers_out->add('X-Goner' => "headers_out");
  +    # this header will make it to the client only on 2xx response
  +    $r->headers_out->add('X-headers_out' => "headers_out");
   
  -    return Apache::NOT_FOUND;
  +    return $r->args eq "404" ? Apache::NOT_FOUND : Apache::OK;
   }
   
   1;
  
  
  

Mime
View raw message