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 Test2::V0;
use Test2::Tools::Exception qw/dies/;
use strict;
use warnings;
use utf8;
use LWP::UserAgent;
use Web::Query;
my $ua = $Web::Query::UserAgent = LWP::UserAgent->new( agent => 'Mozilla/5.0' );
$ua->add_handler(request_send => sub {
my ($request) = @_;
my $code = $request->uri->host eq 'bad.com' ? 500 : 200;
return HTTP::Response->new($code);
});
plan tests => 2;
ok dies {
Web::Query->new('http://bad.com/');
}, "without options";
ok dies {
Web::Query->new('http://bad.com/',{indent=>3});
}, "with options";
|