a5eacc41809e5503bd3fb0cdc119363657127f4c
[catagits/Catalyst-Runtime.git] / t / aggregate / utf8_content_length.t
1 use strict;
2 use warnings;
3 use FindBin qw/$Bin/;
4 use lib "$Bin/../lib";
5 use File::Spec;
6 use Test::More;
7
8 use Catalyst::Test qw/TestAppEncoding/;
9
10 if ( $ENV{CATALYST_SERVER} ) {
11     plan skip_all => 'This test does not run live';
12     exit 0;
13 }
14
15 my $fn = "$Bin/../catalyst_130pix.gif";
16 ok -r $fn, 'Can read catalyst_130pix.gif';
17 my $size = -s $fn;
18 {
19     my $r = request('/binary');
20     is $r->code, 200, '/binary OK';
21     is $r->header('Content-Length'), $size, '/binary correct content length';
22 }
23 SKIP: {
24     # Test that even if what is really binary has been upgraded into character
25     # octets in perl, then when we output it we get the correct content length.
26     # The issue was initially described in the thread 'Avoiding UTF8 in
27     # Catalyst': http://lists.scsys.co.uk/pipermail/catalyst/2009-November/023912.html.
28     # FIXME! (See ml thread re 5.80015 release)
29     skip 'Known not to work on Win32', 2 if ($^O eq 'MSWin32');
30     my $r = request('/binary_utf8');
31     is $r->code, 200, '/binary_utf8 OK';
32     is $r->header('Content-Length'), $size, '/binary_utf8 correct content length';
33 }
34
35 done_testing;
36