diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-03-08 15:52:48 +0100 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-03-08 15:52:48 +0100 |
| commit | d42c9910b8eb1735fce4c3510bfe7db8e8796af5 (patch) | |
| tree | 05773d5fcfff9d1b3b182695b85a5972041bed27 /t | |
| parent | update internal tests (diff) | |
| download | plack-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.t | 20 |
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; |
