[Catalyst-commits] r13777 -
Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sun Dec 5 18:13:48 GMT 2010
Author: t0m
Date: 2010-12-05 18:13:48 +0000 (Sun, 05 Dec 2010)
New Revision: 13777
Modified:
Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm
Log:
Fix local_request. TODO - tests for local_request, make ->psgi_app lazy class data again
Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm 2010-12-05 17:40:45 UTC (rev 13776)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Test.pm 2010-12-05 18:13:48 UTC (rev 13777)
@@ -27,9 +27,7 @@
}
$class->import;
- my $app = $class->psgi_app;
-
- $request = sub { local_request( $app, @_ ) };
+ $request = sub { local_request( $class, @_ ) };
}
my $get = sub { $request->(@_)->content };
@@ -241,8 +239,10 @@
=cut
sub local_request {
- my $app = shift;
+ my $class = shift;
+ my $app = ref($class) eq "CODE" ? $class : $class->psgi_app;
+
my $request = Catalyst::Utils::request(shift);
my %extra_env;
_customize_request($request, \%extra_env, @_);
@@ -251,8 +251,10 @@
test_psgi
app => sub { $app->({ %{ $_[0] }, %extra_env }) },
client => sub {
- my $resp = shift->($request);
+ my $psgi_app = shift;
+ my $resp = $psgi_app->($request);
+
# HTML head parsing based on LWP::UserAgent
#
# This is not just horrible and possibly broken, but also really
More information about the Catalyst-commits
mailing list