#!/usr/bin/env perl
my
$m
= Test::WWW::Mechanize::Catalyst->new;
$m
->content_like(
qr/Content[ ]Ok/
,
'expected text'
);
isa_ok(
my
$c
=
$m
->catalyst_app,
"Catalyst"
,
"catalyst_app"
);
can_ok(
$c
,
qw( not_cached )
) or BAIL_OUT
"missing expected method"
;
foreach
my
$hdr
(
qw( ETag Expires Last-Modified )
) {
my
$aux
= DateTime::Format::HTTP->format_datetime(
DateTime->now->subtract(
minutes
=> 12 )
);
my
$val
= ((
$hdr
eq
'Expires'
) || (
$hdr
eq
'Last-Modified'
)) ?
$aux
: md5_hex(
$aux
);
$uri
->query_form(
$hdr
=>
$val
);
my
$res
=
$m
->get(
$uri
);
ok(
$res
->is_success,
"GET ${uri}"
);
is(
$res
->header(
$hdr
),
$val
,
$hdr
) or BAIL_OUT
"${hdr} header not set as expected"
;
}
done_testing;