5 use lib "$FindBin::Bin/../lib";
7 use Test::More tests => 26;
8 use Catalyst::Test 'TestApp';
11 ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' );
12 ok( $response->is_redirect, 'Response Redirection 3xx' );
13 is( $response->code, 302, 'Response Code' );
14 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' );
15 is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' );
16 ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' );
17 ok( $response->content, '302 Redirect contains a response body' );
21 ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' );
22 ok( $response->is_redirect, 'Response Redirection 3xx' );
23 is( $response->code, 302, 'Response Code' );
24 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' );
25 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
29 ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' );
30 ok( $response->is_redirect, 'Response Redirection 3xx' );
31 is( $response->code, 301, 'Response Code' );
32 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' );
33 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
34 ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' );
35 ok( $response->content, '301 Redirect contains a response body' );
39 ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' );
40 ok( $response->is_redirect, 'Response Redirection 3xx' );
41 is( $response->code, 307, 'Response Code' );
42 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' );
43 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
44 ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' );
45 ok( $response->content, '307 Redirect contains a response body' );