Commit | Line | Data |
794abe2a |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
7 | use lib "$FindBin::Bin/lib"; |
8 | |
9 | use Test::More tests => 4; |
10 | use Catalyst::Test 'TestApp'; |
11 | |
12 | { |
13 | TestApp->config->{require_ssl}->{detach_on_redirect} = 0; |
14 | |
15 | # test an SSL redirect |
16 | ok( my $res = request('http://localhost/ssl/test_detach'), 'request ok' ); |
17 | is( $res->header('location'), 'http://www.mydomain.com/redirect_from_the_action', |
18 | 'the action did the redirect after $c->require_ssl' |
19 | ); |
20 | } |
21 | |
22 | { |
23 | TestApp->config->{require_ssl}->{detach_on_redirect} = 1; |
24 | |
25 | # test an SSL redirect |
26 | ok( my $res = request('http://localhost/ssl/test_detach'), 'request ok' ); |
27 | is( $res->header('location'), 'https://localhost/ssl/test_detach', |
28 | 'the action finished in $c->require_ssl' |
29 | ); |
30 | } |