Skip to content
Closed
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
1 change: 0 additions & 1 deletion lib/Dancer2/Handler/AutoPage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ sub code {
}

my $ct = $template->process( $page );
$app->response->header( 'Content-Length', length($ct) );
return ( $app->request->method eq 'GET' ) ? $ct : '';
};
}
Expand Down
23 changes: 21 additions & 2 deletions t/auto_page.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use HTTP::Request::Common;
set auto_page => 1;
set views => 't/views';
set layout => 'main';
set charset => 'UTF-8';
}


Expand All @@ -33,9 +34,27 @@ sub run_tests {
is( $r->code, 200, 'Autopage found the page' );
like(
$r->content,
qr/---\nHey! This is Auto Page working/,
qr/---\nHey! This is Auto Page wörking/,
'...with proper content',
);

is(
$r->headers->content_type,
'text/html',
'auto page has correct content type header',
);

is(
$r->headers->content_type_charset,
'UTF-8',
'auto page has correct charset in content type header',
);

is(
$r->headers->content_length,
98, # auto_page.tt+layouts/main.tt processed. ö has two bytes in UTF-8
'auto page has correct content length header',
);
}

{
Expand Down Expand Up @@ -71,7 +90,7 @@ sub run_tests {
like(
$r->headers->content_type,
qr{text/plain},
'public served file as correct mime',
'public served file has correct content type header',
);
}
}
Expand Down