package Catalyst::Engine::Test;
use strict;
-use base 'Catalyst::Engine::LWP';
+use base 'Catalyst::Engine::HTTP::Base';
=head1 NAME
=head1 OVERLOADED METHODS
-This class overloads some methods from C<Catalyst::Engine::LWP>.
+This class overloads some methods from C<Catalyst::Engine::HTTP::Base>.
=over 4
unless ( ref $request ) {
- my $uri = ( $request =~ m/http/i )
+ my $uri =
+ ( $request =~ m/http/i )
? URI->new($request)
: URI->new( 'http://localhost' . $request );
$request = HTTP::Request->new( 'GET', $request );
}
- my $lwp = Catalyst::Engine::LWP::HTTP->new(
- request => $request,
+ my $host = sprintf( '%s:%d', $request->uri->host, $request->uri->port );
+ $request->header( 'Host' => $host );
+
+ my $http = Catalyst::Engine::Test::HTTP->new(
address => '127.0.0.1',
- hostname => 'localhost'
+ hostname => 'localhost',
+ request => $request,
+ response => HTTP::Response->new
);
- $class->handler($lwp);
+ $http->response->date(time);
+
+ $class->handler($http);
- return $lwp->response;
+ return $http->response;
}
=back