5 use lib "$FindBin::Bin/../lib";
9 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
11 use Test::More tests => 42*$iters;
12 use Catalyst::Test 'TestApp';
14 if ( $ENV{CAT_BENCHMARK} ) {
16 Benchmark::timethis( $iters, \&run_tests );
28 request('http://localhost/action/path/a%20path%20with%20spaces'),
31 ok( $response->is_success, 'Response Successful 2xx' );
32 is( $response->content_type, 'text/plain', 'Response Content-Type' );
34 $response->header('X-Catalyst-Action'),
35 'action/path/a%20path%20with%20spaces',
39 $response->header('X-Test-Class'),
40 'TestApp::Controller::Action::Path',
45 qr/^bless\( .* 'Catalyst::Request' \)$/s,
46 'Content is a serialized Catalyst::Request'
51 ok( my $response = request('http://localhost/action/path/åäö'),
53 ok( $response->is_success, 'Response Successful 2xx' );
54 is( $response->content_type, 'text/plain', 'Response Content-Type' );
55 is( $response->header('X-Catalyst-Action'),
56 'action/path/%C3%A5%C3%A4%C3%B6', 'Test Action' );
58 $response->header('X-Test-Class'),
59 'TestApp::Controller::Action::Path',
64 qr/^bless\( .* 'Catalyst::Request' \)$/s,
65 'Content is a serialized Catalyst::Request'
70 ok( my $response = request('http://localhost/action/path/'),
72 ok( $response->is_success, 'Response Successful 2xx' );
73 is( $response->content_type, 'text/plain', 'Response Content-Type' );
74 is( $response->header('X-Catalyst-Action'),
75 'action/path', 'Test Action' );
77 $response->header('X-Test-Class'),
78 'TestApp::Controller::Action::Path',
83 qr/^bless\( .* 'Catalyst::Request' \)$/s,
84 'Content is a serialized Catalyst::Request'
89 ok( my $response = request('http://localhost/action/path/spaces_near_parens_singleq'),
91 ok( $response->is_success, 'Response Successful 2xx' );
92 is( $response->content_type, 'text/plain', 'Response Content-Type' );
93 is( $response->header('X-Catalyst-Action'),
94 'action/path/spaces_near_parens_singleq', 'Test Action' );
96 $response->header('X-Test-Class'),
97 'TestApp::Controller::Action::Path',
102 qr/^bless\( .* 'Catalyst::Request' \)$/s,
103 'Content is a serialized Catalyst::Request'
108 ok( my $response = request('http://localhost/action/path/spaces_near_parens_doubleq'),
110 ok( $response->is_success, 'Response Successful 2xx' );
111 is( $response->content_type, 'text/plain', 'Response Content-Type' );
112 is( $response->header('X-Catalyst-Action'),
113 'action/path/spaces_near_parens_doubleq', 'Test Action' );
115 $response->header('X-Test-Class'),
116 'TestApp::Controller::Action::Path',
121 qr/^bless\( .* 'Catalyst::Request' \)$/s,
122 'Content is a serialized Catalyst::Request'
127 ok( my $response = request('http://localhost/0'), 'Request' );
128 ok( $response->is_success, 'Response Successful 2xx' );
129 is( $response->content_type, 'text/plain', 'Response Content-Type' );
130 is( $response->header('X-Catalyst-Action'),
131 '0', 'Test Action' );
133 $response->header('X-Test-Class'),
134 'TestApp::Controller::Root',
139 qr/^bless\( .* 'Catalyst::Request' \)$/s,
140 'Content is a serialized Catalyst::Request'
145 ok( my $response = request('http://localhost/action/path/six'), 'Request' );
146 ok( $response->is_success, 'Response Successful 2xx' );
147 is( $response->content_type, 'text/plain', 'Response Content-Type' );
148 is( $response->header('X-Catalyst-Action'),
149 'action/path/six', 'Test Action' );
151 $response->header('X-Test-Class'),
152 'TestApp::Controller::Action::Path',
157 qr/^bless\( .* 'Catalyst::Request' \)$/s,
158 'Content is a serialized Catalyst::Request'