APR-HTTP-Headers-Compat

 view release on metacpan or  search on metacpan

t/compat/base/headers.t  view on Meta::CPAN

  ok( $h->remove_header( "Abc_Abc" ) );
  ok( !defined( $h->header( "abc_abc" ) ) );
  is( $h->header( "ABC-ABC" ), "bar" );
}

# Check if objects as header values works
SKIP: {
  skip "Can't store references" => 1;
  require URI;
  $h->header( URI => URI->new( "http://www.perl.org" ) );

  is( $h->header( "URI" )->scheme, "http" );
}

$h->clear;
is( $h->as_string, "" );

$h->content_type( "text/plain" );
$h->header( content_md5   => "dummy" );
$h->header( "Content-Foo" => "foo" );
$h->header( Location      => "http:", xyzzy => "plugh!" );

is( $h->as_string, <<EOT);
Location: http:
Content-MD5: dummy
Content-Type: text/plain
Content-Foo: foo
Xyzzy: plugh!
EOT

my $c = $h->remove_content_headers;
is( $h->as_string, <<EOT);
Location: http:
Xyzzy: plugh!
EOT

is( $c->as_string, <<EOT);
Content-MD5: dummy
Content-Type: text/plain
Content-Foo: foo
EOT

$h = mk;
$h->content_type( "text/plain" );
$h->header( ":foo_bar", 1 );
$h->push_header( ":content_type", "text/html" );
is( j( $h->header_field_names ),
  "Content-Type|:content_type|:foo_bar" );
is( $h->header( 'Content-Type' ), "text/plain" );
SKIP: {
  skip "Namespace collision; can't be helped" => 1;
  is( $h->header( ':Content_Type' ), undef );
}
is( $h->header( ':content_type' ), "text/html" );
is( $h->as_string,                 <<EOT);
Content-Type: text/plain
content_type: text/html
foo_bar: 1
EOT

# [RT#30579] IE6 appens "; length = NNNN" on If-Modified-Since (can we handle it)
$h = mk(
  if_modified_since => "Sat, 29 Oct 1994 19:43:31 GMT; length=34343" );
is( gmtime( $h->if_modified_since ), "Sat Oct 29 19:43:31 1994" );



( run in 1.526 second using v1.01-cache-2.11-cpan-39bf76dae61 )