X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_engine_request_uri.t;h=01a19faad22ddd53715aab157276022102445afd;hb=11b256bcd8803498376b86ce234ceb4ee6614bd9;hp=b5fc2405834fda2ef6551eb2e658ce9a330e7797;hpb=c7ded7aaf69e506924a5406349fd665c7717acb8;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_engine_request_uri.t b/t/live_engine_request_uri.t index b5fc240..01a19fa 100644 --- a/t/live_engine_request_uri.t +++ b/t/live_engine_request_uri.t @@ -6,7 +6,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 44; +use Test::More tests => 49; use Catalyst::Test 'TestApp'; use Catalyst::Request; @@ -37,6 +37,21 @@ my $creq; is( $creq->base . $creq->path, $creq->uri, 'Base + Path ok' ); } +# test base is correct for HTTPS URLs +SKIP: +{ + if ( $ENV{CATALYST_SERVER} ) { + skip 'Using remote server', 5; + } + + local $ENV{HTTPS} = 'on'; + ok( my $response = request('https://localhost/engine/request/uri'), 'HTTPS Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); + is( $creq->base, 'https://localhost/', 'HTTPS base ok' ); + is( $creq->uri, 'https://localhost/engine/request/uri', 'HTTPS uri ok' ); +} + # test that we can use semi-colons as separators { my $parameters = { @@ -47,8 +62,8 @@ my $creq; ok( my $response = request('http://localhost/engine/request/uri?a=1;a=2;b=3'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - is( $creq->{uri}->query, 'a=1;a=2;b=3', 'Query string ok' ); - is_deeply( $creq->{parameters}, $parameters, 'Parameters ok' ); + is( $creq->uri->query, 'a=1;a=2;b=3', 'Query string ok' ); + is_deeply( $creq->parameters, $parameters, 'Parameters ok' ); } # test that query params are unescaped properly @@ -56,8 +71,8 @@ my $creq; ok( my $response = request('http://localhost/engine/request/uri?text=Catalyst%20Rocks'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' ); - is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' ); + is( $creq->uri->query, 'text=Catalyst%20Rocks', 'Query string ok' ); + is( $creq->parameters->{text}, 'Catalyst Rocks', 'Unescaped param ok' ); } # test that uri_with adds params @@ -88,7 +103,7 @@ my $creq; { ok( my $response = request('http://localhost/engine/request/uri/uri_with_object'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - like( $response->header( 'X-Catalyst-Param-a' ), qr(http://localhost[^/]*/), 'param "a" ok' ); + like( $response->header( 'X-Catalyst-Param-a' ), qr(https?://localhost[^/]*/), 'param "a" ok' ); } # test that uri_with is utf8 safe @@ -104,3 +119,4 @@ my $creq; ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header( 'X-Catalyst-warnings' ), 0, 'no warnings emitted' ); } +