X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FTest.pm;h=a5f9ca472e27018a8fd5fecde75ad76bec4a6906;hb=21465c884872c1ec8c30acd72796445f9eaacb31;hp=1a4a0e83a6ad9b248a642b6cc371f49e69cbd33f;hpb=45374ac6977e9464410a8c7518fb26ab812258cb;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/Test.pm b/lib/Catalyst/Engine/Test.pm index 1a4a0e8..a5f9ca4 100644 --- a/lib/Catalyst/Engine/Test.pm +++ b/lib/Catalyst/Engine/Test.pm @@ -1,7 +1,9 @@ package Catalyst::Engine::Test; use strict; -use base 'Catalyst::Engine::HTTP'; +use base 'Catalyst::Engine::HTTP::Base'; + +use Catalyst::Utils; =head1 NAME @@ -29,7 +31,7 @@ This is the Catalyst engine specialized for testing. =head1 OVERLOADED METHODS -This class overloads some methods from C. +This class overloads some methods from C. =over 4 @@ -38,28 +40,23 @@ This class overloads some methods from C. =cut sub run { - my $class = shift; - my $request = shift || '/'; - - unless ( ref $request ) { - - my $uri = ( $request =~ m/http/i ) - ? URI->new($request) - : URI->new( 'http://localhost' . $request ); - - $request = $uri->canonical; - } + my ( $class, $request ) = @_; + + $request = Catalyst::Utils::request($request); - unless ( ref $request eq 'HTTP::Request' ) { - $request = HTTP::Request->new( 'GET', $request ); - } + $request->header( + 'Host' => sprintf( '%s:%d', $request->uri->host, $request->uri->port ) + ); - my $http = Catalyst::Engine::HTTP::LWP->new( - request => $request, + my $http = Catalyst::Engine::HTTP::Base::struct->new( address => '127.0.0.1', - hostname => 'localhost' + hostname => 'localhost', + request => $request, + response => HTTP::Response->new ); + $http->response->date(time); + $class->handler($http); return $http->response;