From: Tomas Doran Date: Sun, 7 Aug 2011 12:14:01 +0000 (+0100) Subject: Back compat fix for CX::CRUD and others X-Git-Tag: 5.9000~10^2~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=89222c2a9136170aa4012fbf3c7b804abeff2463 Back compat fix for CX::CRUD and others --- diff --git a/Changes b/Changes index 6d84521..35028a9 100644 --- a/Changes +++ b/Changes @@ -22,6 +22,10 @@ - Fix calling MyApp->engine_class to set the engine class manually. + - Re-add a $res->headers->{status} field to Catalyst::Test responses. + This _should_ be accessed with $c->res->code instead, but is here + for backward compatibility. + Documentation: - Documentation which was in the now removed Catalyst::Engine::* classes diff --git a/TODO b/TODO index 2a856bb..9d718ea 100644 --- a/TODO +++ b/TODO @@ -53,8 +53,6 @@ http://github.com/willert/catalyst-plugin-log4perl-simple/tree * Test::WWW::Mechanize::Catalyst new release - * CatalystX::CRUD 0.51 is broken, but works against latest master. - * Test nginx middleware to determine if it is needed with: root app - with use_request_uri_for_path diff --git a/lib/Catalyst/Test.pm b/lib/Catalyst/Test.pm index ef3def5..5c0cbe7 100644 --- a/lib/Catalyst/Test.pm +++ b/lib/Catalyst/Test.pm @@ -311,6 +311,10 @@ sub _local_request { for my $f ( $h->header_field_names ) { $resp->init_header( $f, [ $h->header($f) ] ); } + # Another horrible hack to make the response headers have a + # 'status' field. This is for back-compat, but you should + # call $resp->code instead! + $resp->init_header('status', [ $resp->code ]); }, }, @_); } diff --git a/t/aggregate/unit_load_catalyst_test.t b/t/aggregate/unit_load_catalyst_test.t index 399b190..68dfbdf 100644 --- a/t/aggregate/unit_load_catalyst_test.t +++ b/t/aggregate/unit_load_catalyst_test.t @@ -153,4 +153,8 @@ lives_ok { request(GET('/dummy'), []); } 'array additional param to request method ignored'; +my $res = request(GET('/')); +is $res->code, 200, 'Response code 200'; +is $res->headers->{status}, 200, 'Back compat "status" header present'; + done_testing;