1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
use strict;
use Test::More;
use LWP::UserAgent;
use LWP::Protocol::PSGI;
my $psgi_app = sub {
return [
200,
[ "Content-Type", "text/plain" ],
[ "Hi" ],
];
};
{
my $guard = LWP::Protocol::PSGI->register($psgi_app, host => "localhost");
my $ua = LWP::UserAgent->new;
my $res = $ua->get("http://localhost:5000/");
is $res->content, "Hi";
}
{
my $guard = LWP::Protocol::PSGI->register($psgi_app, host => "localhost:5000");
my $ua = LWP::UserAgent->new;
my $res = $ua->get("http://localhost:5000/");
is $res->content, "Hi";
}
done_testing;
|