Merge 'module-install' into 'trunk'
[catagits/Catalyst-Plugin-RequireSSL.git] / t / 08detach_on_redirect.t
CommitLineData
794abe2a 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
7use lib "$FindBin::Bin/lib";
8
9use Test::More tests => 4;
10use 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}