X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive-test.t;fp=t%2Flive-test.t;h=765ef8e888db1bf8e10e7b4542ceb9f027136365;hb=cbca054ea5f62fbb361b19d6306316f3b262b575;hp=b1f664d283413567fb3629688f9baf1b98b7661f;hpb=cb930a44c47b11b8075332450369577e8e06187c;p=catagits%2FCatalyst-TraitFor-Request-ProxyBase.git diff --git a/t/live-test.t b/t/live-test.t index b1f664d..765ef8e 100644 --- a/t/live-test.t +++ b/t/live-test.t @@ -2,7 +2,8 @@ use strict; use warnings; -use Test::More tests => 1; +use HTTP::Request::Common; +use Test::More tests => 9; # setup library path use FindBin qw($Bin); @@ -13,6 +14,26 @@ use TestApp; # a live test against TestApp, the test application use Catalyst::Test 'TestApp'; -my ($res, $c) = ctx_request('/'); -is($c->res->body, 'http://localhost/'); +sub req_with_base { + my $base = shift; + + my ($res, $c) = ctx_request(GET('/')); + return $c; +} + +is(req_with_base('http://localhost/')->res->body, 'http://localhost/'); +is(req_with_base('https://localhost/')->res->body, 'https://localhost/'); +ok req_with_base('https://localhost/')->req->secure; + +is(req_with_base('https://example.com:445/')->res->body, + 'https://example.com:445/'); +is(req_with_base('http://example.com:443/')->res->body, + 'http://example.com:443/'); +is(req_with_base('https://example.com:445/some/path')->res->body, + 'https://example.com:445/some/path/'); +is(req_with_base('https://example.com:445/some/path/')->res->body, + 'https://example.com:445/some/path/'); + +ok req_with_base('https://example.com:80/')->req->secure; +ok !req_with_base('http://example.com:443/')->req->secure;