summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-03-08 15:52:48 +0100
committerfranck cuny <franck@lumberjaph.net>2010-03-08 15:52:48 +0100
commitd42c9910b8eb1735fce4c3510bfe7db8e8796af5 (patch)
tree05773d5fcfff9d1b3b182695b85a5972041bed27 /t
parentupdate internal tests (diff)
downloadplack-middleware-etag-d42c9910b8eb1735fce4c3510bfe7db8e8796af5.tar.gz
as miyagawa suggested, use file attributes to calculte ETag in case we have a file handle
Diffstat (limited to 't')
-rw-r--r--t/01_basic.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/01_basic.t b/t/01_basic.t
index 8564ece..62e1e6e 100644
--- a/t/01_basic.t
+++ b/t/01_basic.t
@@ -32,6 +32,12 @@ my $unmodified_handler = builder {
sub { [ '200', [ 'Content-Type' => 'text/html' ], $content ] };
};
+my $file_handler = builder {
+ enable "Plack::Middleware::ETag";
+ open my $fh, 'README';
+ sub {[200, ['Content-Type' => 'text/html', ], $fh]};
+};
+
test_psgi
app => $handler,
client => sub {
@@ -69,4 +75,18 @@ test_psgi
}
};
+test_psgi
+ app => $file_handler,
+ client => sub {
+ my $cb = shift;
+ {
+ my $req = GET "http://localhost/";
+ my $res = $cb->($req);
+ ok $res->header('ETag');
+ warn $res->header('ETag');
+ is $res->code, 200;
+ ok $res->content;
+ }
+};
+
done_testing;