### ----------------------------------------------------
### -- HTTP::UserAgent
### -- Licenses: MIT
### -- Authors: Filip Sergot
### -- File: t/082-exceptions.rakutest
### ----------------------------------------------------
use Test;
use HTTP::UserAgent;

plan 4;

my $ua = HTTP::UserAgent.new;
my $res;

lives-ok { $res = $ua.get('http://httpbin.org/status/404') }, "no exception - expect 404";

ok !$res.is-success, "and it isn't successful";
is $res.code, 404, "and a 404";

$ua = HTTP::UserAgent.new(:throw-exceptions);

throws-like {  $ua.get('http://httpbin.org/status/404') }, X::HTTP::Response, message => "Response error: '404 Not Found'", response => HTTP::Response;

# vim: expandtab shiftwidth=4


