From: Dagfinn Ilmari Mannsåker Date: Mon, 12 May 2014 21:10:21 +0000 (+0100) Subject: Use a fixed body in response header tests X-Git-Tag: 5.90065~4^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=2d6d24356b60aee54cfc81afafdaaccdc3c016db Use a fixed body in response header tests This lets us stop munging the expected length betwen HEAD and GET, and lets us test Content-Length when using an external sever too. --- diff --git a/t/aggregate/live_engine_response_headers.t b/t/aggregate/live_engine_response_headers.t index 6cf9fdc..03a2418 100644 --- a/t/aggregate/live_engine_response_headers.t +++ b/t/aggregate/live_engine_response_headers.t @@ -37,22 +37,11 @@ foreach my $method (qw(HEAD GET)) { 'HEAD method content is empty' ); } elsif ( $method eq 'GET' ) { - # method name is echo'd back in content-body (twice under debug), - # which accounts for difference in content length. In normal - # cases the Content-Length should be the same regardless - # of whether it's a GET or HEAD request. - SKIP: - { - if ( $ENV{CATALYST_SERVER} ) { - skip "Using remote server", 2; - } - my $diff = TestApp->debug ? 2 : 1; - is( $response->header('Content-Length'), - $content_length - $diff, 'Response Header Content-Length' ) - or diag $response->content; - is( length($response->content), - $response->header('Content-Length'), - 'GET method content' ); - } + is( $response->header('Content-Length'), + $content_length, 'Response Header Content-Length' ) + or diag $response->content; + is( length($response->content), + $response->header('Content-Length'), + 'GET method content' ); } } diff --git a/t/lib/TestApp/Controller/Engine/Response/Headers.pm b/t/lib/TestApp/Controller/Engine/Response/Headers.pm index 470eeaf..776862a 100644 --- a/t/lib/TestApp/Controller/Engine/Response/Headers.pm +++ b/t/lib/TestApp/Controller/Engine/Response/Headers.pm @@ -8,7 +8,7 @@ sub one : Relative { $c->res->header( 'X-Header-Catalyst' => 'Cool' ); $c->res->header( 'X-Header-Cool' => 'Catalyst' ); $c->res->header( 'X-Header-Numbers' => join ', ', 1 .. 10 ); - $c->forward('TestApp::View::Dump::Request'); + $c->forward('TestApp::View::Dump', [ { some => [qw(fixed content)] } ]); } 1;