Commit | Line | Data |
dd4e6fd2 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
42da66a9 |
7 | use lib "$FindBin::Bin/../lib"; |
dd4e6fd2 |
8 | |
fa0fae2a |
9 | use Test::More tests => 26; |
dd4e6fd2 |
10 | use Catalyst::Test 'TestApp'; |
11 | |
12 | { |
13 | ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' ); |
14 | ok( $response->is_redirect, 'Response Redirection 3xx' ); |
f1bbebac |
15 | is( $response->code, 302, 'Response Code' ); |
dd4e6fd2 |
16 | is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' ); |
17 | is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' ); |
fa0fae2a |
18 | ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' ); |
19 | ok( $response->content, '302 Redirect contains a response body' ); |
dd4e6fd2 |
20 | } |
21 | |
22 | { |
23 | ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' ); |
24 | ok( $response->is_redirect, 'Response Redirection 3xx' ); |
f1bbebac |
25 | is( $response->code, 302, 'Response Code' ); |
dd4e6fd2 |
26 | is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' ); |
27 | is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' ); |
28 | } |
29 | |
30 | { |
31 | ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' ); |
32 | ok( $response->is_redirect, 'Response Redirection 3xx' ); |
33 | is( $response->code, 301, 'Response Code' ); |
34 | is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' ); |
35 | is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' ); |
fa0fae2a |
36 | ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' ); |
37 | ok( $response->content, '301 Redirect contains a response body' ); |
dd4e6fd2 |
38 | } |
39 | |
40 | { |
41 | ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' ); |
42 | ok( $response->is_redirect, 'Response Redirection 3xx' ); |
43 | is( $response->code, 307, 'Response Code' ); |
44 | is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' ); |
45 | is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' ); |
fa0fae2a |
46 | ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' ); |
47 | ok( $response->content, '307 Redirect contains a response body' ); |
dd4e6fd2 |
48 | } |