X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_engine_request_headers.t;h=9913ff30e2739099a3aebee7b214ab583bbe792b;hb=fcfe92b170baa438adf1ff92057ac007781d02b4;hp=4e4ab74e52bac920f2f8c2616c046ca8ecad05a9;hpb=72eeaf404328dcd54ab95ca5676626a68066cac4;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_engine_request_headers.t b/t/aggregate/live_engine_request_headers.t index 4e4ab74..9913ff3 100644 --- a/t/aggregate/live_engine_request_headers.t +++ b/t/aggregate/live_engine_request_headers.t @@ -1,5 +1,3 @@ -#!perl - use strict; use warnings; @@ -16,7 +14,7 @@ use HTTP::Request::Common; { my $creq; - my $request = GET( 'http://localhost/dump/request', + my $request = GET( 'http://localhost/dump/request', 'User-Agent' => 'MyAgen/1.0', 'X-Whats-Cool' => 'Catalyst', 'X-Multiple' => [ 1 .. 5 ], @@ -24,17 +22,17 @@ use HTTP::Request::Common; 'X-Forwarded-For' => '192.168.1.1, 1.2.3.4', 'X-Forwarded-Port' => 443 ); - + ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); + ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ) or fail("Exception deseializing $@ from content " . $response->content); isa_ok( $creq, 'Catalyst::Request' ); ok( $creq->secure, 'Forwarded port sets secure' ); isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' ); is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' ); - + { # Test that multiple headers are joined as per RFC 2616 4.2 and RFC 3875 4.1.18 my $excpected = '1, 2, 3, 4, 5'; @@ -53,7 +51,7 @@ use HTTP::Request::Common; if ( $ENV{CATALYST_SERVER} && $ENV{CATALYST_SERVER} !~ /127.0.0.1|localhost/ ) { skip "Using remote server", 2; } - + is( $creq->base->host, 'frontend.server.com', 'Catalyst::Request proxied base' ); is( $creq->address, '1.2.3.4', 'Catalyst::Request proxied address' ); }