7 use lib "$FindBin::Bin/lib";
11 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
13 use Test::More tests => 32*$iters;
14 use Catalyst::Test 'TestApp';
16 if ( $ENV{CAT_BENCHMARK} ) {
18 Benchmark::timethis( $iters, \&run_tests );
28 ok( my $response = request('http://localhost/action/local/one'),
30 ok( $response->is_success, 'Response Successful 2xx' );
31 is( $response->content_type, 'text/plain', 'Response Content-Type' );
32 is( $response->header('X-Catalyst-Action'),
33 'action/local/one', 'Test Action' );
35 $response->header('X-Test-Class'),
36 'TestApp::Controller::Action::Local',
41 qr/^bless\( .* 'Catalyst::Request' \)$/s,
42 'Content is a serialized Catalyst::Request'
47 ok( my $response = request('http://localhost/action/local/two/1/2'),
49 ok( $response->is_success, 'Response Successful 2xx' );
50 is( $response->content_type, 'text/plain', 'Response Content-Type' );
51 is( $response->header('X-Catalyst-Action'),
52 'action/local/two', 'Test Action' );
54 $response->header('X-Test-Class'),
55 'TestApp::Controller::Action::Local',
60 qr/^bless\( .* 'Catalyst::Request' \)$/s,
61 'Content is a serialized Catalyst::Request'
66 ok( my $response = request('http://localhost/action/local/two'),
68 ok( !$response->is_success, 'Request with wrong number of args failed' );
72 ok( my $response = request('http://localhost/action/local/three'),
74 ok( $response->is_success, 'Response Successful 2xx' );
75 is( $response->content_type, 'text/plain', 'Response Content-Type' );
76 is( $response->header('X-Catalyst-Action'),
77 'action/local/three', 'Test Action' );
79 $response->header('X-Test-Class'),
80 'TestApp::Controller::Action::Local',
85 qr/^bless\( .* 'Catalyst::Request' \)$/s,
86 'Content is a serialized Catalyst::Request'
93 request('http://localhost/action/local/four/five/six'),
96 ok( $response->is_success, 'Response Successful 2xx' );
97 is( $response->content_type, 'text/plain', 'Response Content-Type' );
98 is( $response->header('X-Catalyst-Action'),
99 'action/local/four/five/six', 'Test Action' );
101 $response->header('X-Test-Class'),
102 'TestApp::Controller::Action::Local',
107 qr/^bless\( .* 'Catalyst::Request' \)$/s,
108 'Content is a serialized Catalyst::Request'
114 if ( $ENV{CATALYST_SERVER} ) {
115 skip "tests for %2F on remote server", 6;
120 request('http://localhost/action/local/one/foo%2Fbar'),
123 ok( $response->is_success, 'Response Successful 2xx' );
124 is( $response->content_type, 'text/plain', 'Response Content-Type' );
125 is( $response->header('X-Catalyst-Action'),
126 'action/local/one', 'Test Action' );
128 $response->header('X-Test-Class'),
129 'TestApp::Controller::Action::Local',
134 qr~arguments => \[\s*'foo/bar'\s*\]~,
135 "Parameters don't split on %2F"