Commit | Line | Data |
dd4e6fd2 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use FindBin; |
42da66a9 |
5 | use lib "$FindBin::Bin/../lib"; |
dd4e6fd2 |
6 | |
fa0fae2a |
7 | use Test::More tests => 26; |
dd4e6fd2 |
8 | use Catalyst::Test 'TestApp'; |
9 | |
10 | { |
11 | ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' ); |
12 | ok( $response->is_redirect, 'Response Redirection 3xx' ); |
f1bbebac |
13 | is( $response->code, 302, 'Response Code' ); |
dd4e6fd2 |
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' ); |
fa0fae2a |
16 | ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' ); |
17 | ok( $response->content, '302 Redirect contains a response body' ); |
dd4e6fd2 |
18 | } |
19 | |
20 | { |
21 | ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' ); |
22 | ok( $response->is_redirect, 'Response Redirection 3xx' ); |
f1bbebac |
23 | is( $response->code, 302, 'Response Code' ); |
dd4e6fd2 |
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' ); |
26 | } |
27 | |
28 | { |
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' ); |
fa0fae2a |
34 | ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' ); |
35 | ok( $response->content, '301 Redirect contains a response body' ); |
dd4e6fd2 |
36 | } |
37 | |
38 | { |
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' ); |
fa0fae2a |
44 | ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' ); |
45 | ok( $response->content, '307 Redirect contains a response body' ); |
dd4e6fd2 |
46 | } |