Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Plack/Middleware/ConditionalGET.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sub call {

$self->response_cb($res, sub {
my $res = shift;

return unless $res->[0] == 200;
my $h = Plack::Util::headers($res->[1]);

# check both ETag and If-Modified-Since, and at least one should exist
Expand Down
11 changes: 6 additions & 5 deletions t/Plack-Middleware/conditionalget.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ my @tests = (
status => 304,
headers => [ ETag => $tag ],
},
{
app => sub { [ 404, [ 'ETag' => $tag, 'Content-Type' => 'text/plain' ], [ 'Not Found' ] ] },
env => { REQUEST_METHOD => "GET", HTTP_IF_NONE_MATCH => $tag },
status => 404,
headers => [ ETag => $tag, 'Content-Type' => 'text/plain' ],
},
{
app => sub { [ 200, [ 'Last-Modified' => $date, 'Content-Type' => 'text/plain' ], [ 'OK' ] ] },
env => { REQUEST_METHOD => "GET", HTTP_IF_MODIFIED_SINCE => $date },
Expand Down Expand Up @@ -80,8 +86,3 @@ for my $block (@tests) {
is $res->[0], $block->{status};
is_deeply $res->[1], $block->{headers};
}